• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 colorGreen, colorRed;
2int scratchVar = 0;
3
4bool test_flat() {
5    return true;
6    ++scratchVar; // should be eliminated
7    return false; // should be eliminated
8}
9
10bool test_if() {
11    if (colorGreen.g > 0) {
12        return true;
13    } else {
14        ++scratchVar;
15    }
16    ++scratchVar;
17    return false;
18}
19
20bool test_else() {
21    if (colorGreen.g == 0) {
22        return false;
23    } else {
24        return true;
25    }
26    ++scratchVar; // should be eliminated
27    return false; // should be eliminated
28}
29
30bool test_loop_if() {
31    for (int x=0; x<=1; ++x) {
32        if (colorGreen.g == 0) {
33            return false;
34        } else {
35            return true;
36        }
37        ++scratchVar; // should be eliminated
38    }
39    ++scratchVar;
40    return true;
41}
42
43half4 main(float2 xy) {
44    return test_flat() && test_if() && test_else() && test_loop_if()
45            ? colorGreen
46            : colorRed;
47}
48