xref: /aosp_15_r20/external/skia/resources/sksl/shared/TernaryOneZeroOptimization.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen, colorRed;
2
3half4 main(float2 coords) {
4    bool ok = true;
5    bool TRUE = bool(colorGreen.g);
6
7    ok = ok && (1 == (TRUE ? 1 : 0));
8    ok = ok && (1.0 == (TRUE ? 1.0 : 0.0));
9
10    ok = ok && (bool(TRUE ? 1 : 0));
11    ok = ok && (1 == int(TRUE ? 1 : 0));
12    ok = ok && (1.0 == float(TRUE ? 1.0 : 0.0));
13
14    ok = ok && (bool2(true) == bool2(TRUE ? 1 : 0));
15    ok = ok && (int2(1) == int2(TRUE ? 1 : 0));
16    ok = ok && (float2(1.0) == float2(TRUE ? 1.0 : 0.0));
17
18    return ok ? colorGreen : colorRed;
19}
20