xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwitchWithLoopsES3StandaloneSettings.glsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1
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    switch (x) {
9        case 1:
10            while (i < 10) {
11                ++i;
12                ++val;
13                continue;
14            }
15        default:
16            ++val;
17    }
18    return val == 11;
19}
20bool while_loop_with_break_in_switch_bi(int x) {
21    int val = 0;
22    int i = 0;
23    while (i < 10) {
24        ++i;
25        switch (x) {
26            case 1:
27                ++val;
28                break;
29            default:
30                return false;
31        }
32        ++val;
33    }
34    return val == 20;
35}
36bool switch_with_break_in_do_while_loop_bi(int x) {
37    int val = 0;
38    int i = 0;
39    switch (x) {
40        case 1:
41            do {
42                ++i;
43                ++val;
44                break;
45            } while (i < 10);
46        default:
47            ++val;
48    }
49    return val == 2;
50}
51bool switch_with_continue_in_do_while_loop_bi(int x) {
52    int val = 0;
53    int i = 0;
54    switch (x) {
55        case 1:
56            do {
57                ++i;
58                ++val;
59                continue;
60            } while (i < 10);
61        default:
62            ++val;
63    }
64    return val == 11;
65}
66bool do_while_loop_with_break_in_switch_bi(int x) {
67    int val = 0;
68    int i = 0;
69    do {
70        ++i;
71        switch (x) {
72            case 1:
73                ++val;
74                break;
75            default:
76                return false;
77        }
78        ++val;
79    } while (i < 10);
80    return val == 20;
81}
82vec4 main() {
83    int x = int(colorGreen.y);
84    int _0_val = 0;
85    int _1_i = 0;
86    switch (x) {
87        case 1:
88            while (_1_i < 10) {
89                ++_1_i;
90                ++_0_val;
91                break;
92            }
93        default:
94            ++_0_val;
95    }
96    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;
97}
98