xref: /aosp_15_r20/external/skia/resources/sksl/runtime/SwitchWithFallthrough.rts (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen, colorRed;
2
3bool switch_fallthrough(int value) {
4    bool ok = false;
5    switch (value) {
6        case 2:  break;
7        case 1:
8        case 0:  ok = true; break;
9        default: break;
10    }
11    return ok;
12}
13
14bool switch_fallthrough_twice(int value) {
15    bool ok = false;
16    switch (value) {
17        case 0:  break;
18        case 1:
19        case 2:
20        case 3:  ok = true; break;
21        default: break;
22    }
23    return ok;
24}
25
26half4 main(float2 coords) {
27    int x = int(colorGreen.g);
28    return (switch_fallthrough(x) && switch_fallthrough_twice(x)) ? colorGreen : colorRed;
29}
30