John Stiles | cb40008 | 2021-09-23 11:07:32 -0400 | [diff] [blame^] | 1 | uniform half4 colorGreen, colorRed; |
| 2 | |
| 3 | bool 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 | |
| 14 | bool 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 | |
| 26 | half4 main(float2 coords) { |
| 27 | int x = int(colorGreen.g); |
| 28 | return (switch_fallthrough(x) && switch_fallthrough_twice(x)) ? colorGreen : colorRed; |
| 29 | } |