xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwitchWithLoops.glsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker#version 400
2*c8dee2aaSAndroid Build Coastguard Workerout vec4 sk_FragColor;
3*c8dee2aaSAndroid Build Coastguard Workeruniform vec4 colorGreen;
4*c8dee2aaSAndroid Build Coastguard Workeruniform vec4 colorRed;
5*c8dee2aaSAndroid Build Coastguard Workerbool switch_with_continue_in_loop_bi(int x) {
6*c8dee2aaSAndroid Build Coastguard Worker    int val = 0;
7*c8dee2aaSAndroid Build Coastguard Worker    int _tmpSwitchValue1 = x, _tmpSwitchFallthrough0 = 0;
8*c8dee2aaSAndroid Build Coastguard Worker    for (int _tmpSwitchLoop2 = 0; _tmpSwitchLoop2 < 1; _tmpSwitchLoop2++) {
9*c8dee2aaSAndroid Build Coastguard Worker        if ((_tmpSwitchValue1 == 1)) {
10*c8dee2aaSAndroid Build Coastguard Worker            for (int i = 0;i < 10; ++i) {
11*c8dee2aaSAndroid Build Coastguard Worker                ++val;
12*c8dee2aaSAndroid Build Coastguard Worker                continue;
13*c8dee2aaSAndroid Build Coastguard Worker            }
14*c8dee2aaSAndroid Build Coastguard Worker            _tmpSwitchFallthrough0 = 1;
15*c8dee2aaSAndroid Build Coastguard Worker        }
16*c8dee2aaSAndroid Build Coastguard Worker        ++val;
17*c8dee2aaSAndroid Build Coastguard Worker    }
18*c8dee2aaSAndroid Build Coastguard Worker    return val == 11;
19*c8dee2aaSAndroid Build Coastguard Worker}
20*c8dee2aaSAndroid Build Coastguard Workerbool loop_with_break_in_switch_bi(int x) {
21*c8dee2aaSAndroid Build Coastguard Worker    int val = 0;
22*c8dee2aaSAndroid Build Coastguard Worker    for (int i = 0;i < 10; ++i) {
23*c8dee2aaSAndroid Build Coastguard Worker        int _tmpSwitchValue4 = x, _tmpSwitchFallthrough3 = 0;
24*c8dee2aaSAndroid Build Coastguard Worker        for (int _tmpSwitchLoop5 = 0; _tmpSwitchLoop5 < 1; _tmpSwitchLoop5++) {
25*c8dee2aaSAndroid Build Coastguard Worker            if ((_tmpSwitchValue4 == 1)) {
26*c8dee2aaSAndroid Build Coastguard Worker                ++val;
27*c8dee2aaSAndroid Build Coastguard Worker                break;
28*c8dee2aaSAndroid Build Coastguard Worker                _tmpSwitchFallthrough3 = 1;
29*c8dee2aaSAndroid Build Coastguard Worker            }
30*c8dee2aaSAndroid Build Coastguard Worker            return false;
31*c8dee2aaSAndroid Build Coastguard Worker        }
32*c8dee2aaSAndroid Build Coastguard Worker        ++val;
33*c8dee2aaSAndroid Build Coastguard Worker    }
34*c8dee2aaSAndroid Build Coastguard Worker    return val == 20;
35*c8dee2aaSAndroid Build Coastguard Worker}
36*c8dee2aaSAndroid Build Coastguard Workervec4 main() {
37*c8dee2aaSAndroid Build Coastguard Worker    int x = int(colorGreen.y);
38*c8dee2aaSAndroid Build Coastguard Worker    int _0_val = 0;
39*c8dee2aaSAndroid Build Coastguard Worker    int _tmpSwitchValue7 = x, _tmpSwitchFallthrough6 = 0;
40*c8dee2aaSAndroid Build Coastguard Worker    for (int _tmpSwitchLoop8 = 0; _tmpSwitchLoop8 < 1; _tmpSwitchLoop8++) {
41*c8dee2aaSAndroid Build Coastguard Worker        if ((_tmpSwitchValue7 == 1)) {
42*c8dee2aaSAndroid Build Coastguard Worker            for (int _1_i = 0;_1_i < 10; ++_1_i) {
43*c8dee2aaSAndroid Build Coastguard Worker                ++_0_val;
44*c8dee2aaSAndroid Build Coastguard Worker                break;
45*c8dee2aaSAndroid Build Coastguard Worker            }
46*c8dee2aaSAndroid Build Coastguard Worker            _tmpSwitchFallthrough6 = 1;
47*c8dee2aaSAndroid Build Coastguard Worker        }
48*c8dee2aaSAndroid Build Coastguard Worker        ++_0_val;
49*c8dee2aaSAndroid Build Coastguard Worker    }
50*c8dee2aaSAndroid Build Coastguard Worker    return (_0_val == 2 && switch_with_continue_in_loop_bi(x)) && loop_with_break_in_switch_bi(x) ? colorGreen : colorRed;
51*c8dee2aaSAndroid Build Coastguard Worker}
52