• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 colorGreen, colorRed;
2uniform half unknownInput; // = 1
3
4bool inside_while_loop() {
5    while (unknownInput == 123) {
6        return false;
7    }
8    return true;
9}
10
11bool inside_infinite_do_loop() {
12    do {
13        return true;
14    } while (true);
15}
16
17bool inside_infinite_while_loop() {
18    while (true) {
19        return true;
20    }
21}
22
23bool after_do_loop() {
24    do {
25        break;
26    } while (true);
27    return true;
28}
29
30bool after_while_loop() {
31    while (true) {
32        break;
33    }
34    return true;
35}
36
37bool switch_with_all_returns() {
38    switch (int(unknownInput)) {
39        case 1:  return true;
40        case 2:  return false;
41        default: return false;
42    }
43}
44
45bool switch_fallthrough() {
46    switch (int(unknownInput)) {
47        case 1:  return true;
48        case 2:
49        default: return false;
50    }
51}
52
53bool switch_fallthrough_twice() {
54    switch (int(unknownInput)) {
55        case 1:
56        case 2:
57        default: return true;
58    }
59}
60
61bool switch_with_break_in_loop() {
62    switch (int(unknownInput)) {
63        case 1:  for (int x=0; x<=10; ++x) { break; }
64        default: return true;
65    }
66}
67
68bool switch_with_continue_in_loop() {
69    switch (int(unknownInput)) {
70        case 1:  for (int x=0; x<=10; ++x) { continue; }
71        default: return true;
72    }
73}
74
75bool switch_with_if_that_returns() {
76    switch (int(unknownInput)) {
77        case 1:  if (unknownInput == 123) return false; else return true;
78        default: return true;
79    }
80}
81
82bool switch_with_one_sided_if_then_fallthrough() {
83    switch (int(unknownInput)) {
84        case 1:  if (unknownInput == 123) return false;
85        default: return true;
86    }
87}
88
89half4 main(float2 coords) {
90    return  inside_while_loop() &&
91            inside_infinite_do_loop() &&
92            inside_infinite_while_loop() &&
93            after_do_loop() &&
94            after_while_loop() &&
95            switch_with_all_returns() &&
96            switch_fallthrough() &&
97            switch_fallthrough_twice() &&
98            switch_with_break_in_loop() &&
99            switch_with_continue_in_loop() &&
100            switch_with_if_that_returns() &&
101            switch_with_one_sided_if_then_fallthrough() ? colorGreen : colorRed;
102}
103