skia2/tests/sksl/folding/StructFieldFolding.glsl
John Stiles b6f91bc023 Optimize away equality checks for structs with known values.
We had all the moving parts in place, but had neglected to check
`simplify_constant_equality` for structs. It worked for structs that
boiled down to the same expression tree, but not for mismatched structs.
Comparison of known structs should be allowed in a constant-expression.

Change-Id: I3a52abf4530d1fe25d17eb482c1e29b5b8e03cf6
Bug: skia:13387
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547444
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-06-06 20:59:15 +00:00

17 lines
330 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
struct S {
int a;
int b;
int c;
};
vec4 main() {
int _6_two = 2;
int _7_flatten0 = 1;
int _8_flatten1 = _6_two;
int _9_flatten2 = 3;
return (_7_flatten0 == 1 && _8_flatten1 == 2) && _9_flatten2 == 3 ? colorGreen : colorRed;
}