xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwitchWithFallthrough.glsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#version 400
2out vec4 sk_FragColor;
3uniform vec4 colorGreen;
4uniform vec4 colorRed;
5bool switch_fallthrough_twice_bi(int value) {
6    bool ok = false;
7    int _tmpSwitchValue1 = value, _tmpSwitchFallthrough0 = 0;
8    for (int _tmpSwitchLoop2 = 0; _tmpSwitchLoop2 < 1; _tmpSwitchLoop2++) {
9        if ((_tmpSwitchValue1 == 0)) {
10            break;
11            _tmpSwitchFallthrough0 = 1;
12        }
13        if ((_tmpSwitchFallthrough0 > 0) || (_tmpSwitchValue1 == 1)) {
14            ;
15            _tmpSwitchFallthrough0 = 1;
16        }
17        if ((_tmpSwitchFallthrough0 > 0) || (_tmpSwitchValue1 == 2)) {
18            ;
19            _tmpSwitchFallthrough0 = 1;
20        }
21        if ((_tmpSwitchFallthrough0 > 0) || (_tmpSwitchValue1 == 3)) {
22            ok = true;
23            break;
24            _tmpSwitchFallthrough0 = 1;
25        }
26        break;
27    }
28    return ok;
29}
30vec4 main() {
31    int x = int(colorGreen.y);
32    bool _0_ok = false;
33    int _tmpSwitchValue4 = x, _tmpSwitchFallthrough3 = 0;
34    for (int _tmpSwitchLoop5 = 0; _tmpSwitchLoop5 < 1; _tmpSwitchLoop5++) {
35        if ((_tmpSwitchValue4 == 2)) {
36            break;
37            _tmpSwitchFallthrough3 = 1;
38        }
39        if ((_tmpSwitchFallthrough3 > 0) || (_tmpSwitchValue4 == 1)) {
40            ;
41            _tmpSwitchFallthrough3 = 1;
42        }
43        if ((_tmpSwitchFallthrough3 > 0) || (_tmpSwitchValue4 == 0)) {
44            _0_ok = true;
45            break;
46            _tmpSwitchFallthrough3 = 1;
47        }
48        break;
49    }
50    return _0_ok && switch_fallthrough_twice_bi(x) ? colorGreen : colorRed;
51}
52