skia2/tests/sksl/inliner/InlinerManglesNames.glsl
John Stiles 049f0dfaba Reduce unnecessary scratch variables in Inliner.
Arguments without side-effects that aren't read from more than once can
be moved directly into the inlined function, and don't need a scratch
variable. This can allow functions like `guarded_divide` to inline
completely in more cases.

Change-Id: I0bfce35635cf9779f4af1bc0790da966ccfe4230
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386678
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-19 14:10:29 +00:00

13 lines
301 B
GLSL

out vec4 sk_FragColor;
uniform vec4 color;
vec4 main() {
float _0_c = color.x * color.y + color.z;
float a = _0_c;
float _1_c = color.y * color.z + color.w;
float b = _1_c;
float _2_c = color.z * color.w + color.x;
float c = _2_c;
return vec4(a, b, c * c, a * (b * c));
}