skia2/tests/sksl/folding/CastFolding.glsl
John Stiles dabb2891c4 Fold casts of known values at compile time.
A cast like `float(five)` or `int4(colorGreen)` will now detect const
variables and replace the expression with its compile-time constant
equivalent value. This can unblock further constant folding
opportunities.

(This CL is very similar in spirit to http://review.skia.org/404676)

Change-Id: If78a2091770777b0caaaec696fe15a0f55d88c24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405683
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-07 22:04:48 +00:00

9 lines
153 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
vec4 main() {
bool _4_ok = true;
return _4_ok ? colorGreen : colorRed;
}