xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwitchWithLoopsES3.glsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#version 400
2out vec4 sk_FragColor;
3uniform vec4 colorGreen;
4uniform vec4 colorRed;
5bool switch_with_continue_in_while_loop_bi(int x) {
6    int val = 0;
7    int i = 0;
8    int _tmpSwitchValue1 = x, _tmpSwitchFallthrough0 = 0;
9    for (int _tmpSwitchLoop2 = 0; _tmpSwitchLoop2 < 1; _tmpSwitchLoop2++) {
10        if ((_tmpSwitchValue1 == 1)) {
11            while (i < 10) {
12                ++i;
13                ++val;
14                continue;
15            }
16            _tmpSwitchFallthrough0 = 1;
17        }
18        ++val;
19    }
20    return val == 11;
21}
22bool while_loop_with_break_in_switch_bi(int x) {
23    int val = 0;
24    int i = 0;
25    while (i < 10) {
26        ++i;
27        int _tmpSwitchValue4 = x, _tmpSwitchFallthrough3 = 0;
28        for (int _tmpSwitchLoop5 = 0; _tmpSwitchLoop5 < 1; _tmpSwitchLoop5++) {
29            if ((_tmpSwitchValue4 == 1)) {
30                ++val;
31                break;
32                _tmpSwitchFallthrough3 = 1;
33            }
34            return false;
35        }
36        ++val;
37    }
38    return val == 20;
39}
40bool switch_with_break_in_do_while_loop_bi(int x) {
41    int val = 0;
42    int i = 0;
43    int _tmpSwitchValue7 = x, _tmpSwitchFallthrough6 = 0;
44    for (int _tmpSwitchLoop8 = 0; _tmpSwitchLoop8 < 1; _tmpSwitchLoop8++) {
45        if ((_tmpSwitchValue7 == 1)) {
46            do {
47                ++i;
48                ++val;
49                break;
50            } while (i < 10);
51            _tmpSwitchFallthrough6 = 1;
52        }
53        ++val;
54    }
55    return val == 2;
56}
57bool switch_with_continue_in_do_while_loop_bi(int x) {
58    int val = 0;
59    int i = 0;
60    int _tmpSwitchValue10 = x, _tmpSwitchFallthrough9 = 0;
61    for (int _tmpSwitchLoop11 = 0; _tmpSwitchLoop11 < 1; _tmpSwitchLoop11++) {
62        if ((_tmpSwitchValue10 == 1)) {
63            do {
64                ++i;
65                ++val;
66                continue;
67            } while (i < 10);
68            _tmpSwitchFallthrough9 = 1;
69        }
70        ++val;
71    }
72    return val == 11;
73}
74bool do_while_loop_with_break_in_switch_bi(int x) {
75    int val = 0;
76    int i = 0;
77    do {
78        ++i;
79        int _tmpSwitchValue13 = x, _tmpSwitchFallthrough12 = 0;
80        for (int _tmpSwitchLoop14 = 0; _tmpSwitchLoop14 < 1; _tmpSwitchLoop14++) {
81            if ((_tmpSwitchValue13 == 1)) {
82                ++val;
83                break;
84                _tmpSwitchFallthrough12 = 1;
85            }
86            return false;
87        }
88        ++val;
89    } while (i < 10);
90    return val == 20;
91}
92vec4 main() {
93    int x = int(colorGreen.y);
94    int _0_val = 0;
95    int _1_i = 0;
96    int _tmpSwitchValue16 = x, _tmpSwitchFallthrough15 = 0;
97    for (int _tmpSwitchLoop17 = 0; _tmpSwitchLoop17 < 1; _tmpSwitchLoop17++) {
98        if ((_tmpSwitchValue16 == 1)) {
99            while (_1_i < 10) {
100                ++_1_i;
101                ++_0_val;
102                break;
103            }
104            _tmpSwitchFallthrough15 = 1;
105        }
106        ++_0_val;
107    }
108    return ((((_0_val == 2 && switch_with_continue_in_while_loop_bi(x)) && while_loop_with_break_in_switch_bi(x)) && switch_with_break_in_do_while_loop_bi(x)) && switch_with_continue_in_do_while_loop_bi(x)) && do_while_loop_with_break_in_switch_bi(x) ? colorGreen : colorRed;
109}
110