| uniform half4 colorRed, colorGreen; |
| |
| struct S { |
| int a, b, c; |
| }; |
| |
| void check_array_1(int[1]) {} |
| void check_array_2(int[2]) {} |
| void check_array_3(int[3]) {} |
| |
| bool test() { |
| const S x = S(1, 2, 3); |
| const S xx = S(1, 2, 3); |
| const S y = S(1, 2, 4); |
| |
| int a[x.a]; |
| int b[x.b]; |
| int c[x.c]; |
| check_array_1(a); |
| check_array_2(b); |
| check_array_3(c); |
| |
| // Structs with elements lacking side-effects can be optimized. |
| int two = 2; |
| int flatten0 = S(x.a, two, 3).a; |
| int flatten1 = S(x.a, two, 3).b; |
| int flatten2 = S(x.a, two, 3).c; |
| |
| return (x == xx) && !(x != xx) && (x != y) && !(x == y) && (x.a == y.a) && |
| (flatten0 == x.a) && (flatten1 == x.b) && (flatten2 == x.c); |
| } |
| |
| half4 main(float2 coords) { |
| return test() ? colorGreen : colorRed; |
| } |