John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 1 | #version 300 es |
John Kessenich | 1fde51d | 2013-07-01 17:56:24 +0000 | [diff] [blame] | 2 | precision highp float; |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 3 | uniform int c, d; |
John Kessenich | 01fc064 | 2013-06-24 21:22:03 +0000 | [diff] [blame] | 4 | in highp float x; |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 5 | |
6 | void main() | ||||
7 | { | ||||
8 | float f; | ||||
9 | int a[2]; | ||||
10 | |||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 11 | switch(f) { // ERROR |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 12 | } |
13 | |||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 14 | switch(a) { // ERROR |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 15 | } |
16 | |||||
17 | switch(c) | ||||
18 | { | ||||
19 | } | ||||
20 | |||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 21 | switch(c) // ERROR, not enough stuff after last label |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 22 | { |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 23 | case 2: |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 24 | } |
25 | |||||
26 | switch(c) | ||||
27 | { | ||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 28 | f = sin(x); // ERRROR |
29 | case 2: | ||||
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 30 | f = cos(x); |
31 | break; | ||||
32 | } | ||||
33 | |||||
34 | switch (c) { | ||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 35 | default: |
36 | break; | ||||
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 37 | case 1: |
38 | f = sin(x); | ||||
39 | break; | ||||
40 | case 2: | ||||
41 | f = cos(x); | ||||
42 | break; | ||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 43 | default: // ERROR, 2nd default |
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 44 | f = tan(x); |
45 | } | ||||
46 | |||||
47 | switch (c) { | ||||
48 | case 1: | ||||
49 | f = sin(x); | ||||
50 | break; | ||||
51 | case 2: | ||||
52 | switch (d) { | ||||
53 | case 1: | ||||
54 | f = x * x * x; | ||||
55 | break; | ||||
56 | case 2: | ||||
57 | f = x * x; | ||||
58 | break; | ||||
59 | } | ||||
60 | break; | ||||
61 | default: | ||||
62 | f = tan(x); | ||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 63 | case 1: // ERROR, 2nd 'case 1' |
64 | break; | ||||
65 | case 3.8: // ERROR, non-int | ||||
66 | break; | ||||
67 | case c: // ERROR, non-constant | ||||
68 | break; | ||||
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 69 | } |
70 | |||||
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 71 | switch (c) { // a no-error normal switch |
72 | case 1: | ||||
73 | f = sin(x); | ||||
74 | break; | ||||
75 | case 2: | ||||
76 | switch (d) { | ||||
77 | case 1: | ||||
78 | f = x * x * x; | ||||
79 | break; | ||||
80 | case 2: | ||||
81 | f = x * x; | ||||
82 | break; | ||||
83 | } | ||||
84 | break; | ||||
85 | default: | ||||
86 | f = tan(x); | ||||
87 | } | ||||
88 | |||||
89 | break; // ERROR | ||||
John Kessenich | 7fd9e11 | 2013-12-04 21:48:20 +0000 | [diff] [blame] | 90 | |
91 | switch (c) { | ||||
92 | case 1: | ||||
93 | f = sin(x); | ||||
94 | break; | ||||
95 | case 2: | ||||
96 | switch (d) { | ||||
97 | case 1: | ||||
98 | { | ||||
99 | case 4: // ERROR | ||||
100 | break; | ||||
101 | } | ||||
102 | f = x * x * x; | ||||
103 | if (c < d) { | ||||
104 | case 2: // ERROR | ||||
105 | f = x * x; | ||||
106 | } | ||||
107 | if (d < c) | ||||
108 | case 3: // ERROR | ||||
109 | break; | ||||
110 | } | ||||
111 | break; | ||||
John Kessenich | 99b0ffd | 2013-12-31 00:13:26 +0000 | [diff] [blame] | 112 | case 4: |
John Kessenich | 7fd9e11 | 2013-12-04 21:48:20 +0000 | [diff] [blame] | 113 | f = tan(x); |
John Kessenich | 99b0ffd | 2013-12-31 00:13:26 +0000 | [diff] [blame] | 114 | if (f < 0.0) |
115 | default: // ERROR | ||||
116 | break; | ||||
John Kessenich | 7fd9e11 | 2013-12-04 21:48:20 +0000 | [diff] [blame] | 117 | } |
118 | |||||
John Kessenich | 99b0ffd | 2013-12-31 00:13:26 +0000 | [diff] [blame] | 119 | case 5: // ERROR |
120 | default: // ERROR | ||||
John Kessenich | 71e01cb | 2014-03-17 22:48:25 +0000 | [diff] [blame] | 121 | |
122 | switch (0) { | ||||
123 | default: | ||||
124 | int onlyInSwitch = 0; | ||||
125 | } | ||||
126 | onlyInSwitch; // ERROR | ||||
127 | |||||
128 | switch (0) { | ||||
129 | default: | ||||
130 | int x; // current "no statement" ERROR, but maybe this should count as a statement, or the semantic check removed | ||||
131 | } | ||||
132 | |||||
133 | switch (c) { | ||||
134 | case 1: | ||||
135 | { | ||||
136 | int nestedX; | ||||
137 | break; | ||||
138 | } | ||||
139 | case 2: | ||||
140 | nestedX; // ERROR | ||||
141 | break; | ||||
142 | case 3: | ||||
143 | int linearZ; | ||||
144 | break; | ||||
145 | case 4: | ||||
146 | int linearY = linearZ; | ||||
147 | break; | ||||
148 | case 5: // ERROR? that branch bypassed an initializer? | ||||
149 | const int linearC = 4; | ||||
150 | break; | ||||
151 | case 6: // ERROR? that branch bypassed an initializer? | ||||
152 | linearC; | ||||
153 | } | ||||
John Kessenich | 0576126 | 2013-04-12 03:57:02 +0000 | [diff] [blame] | 154 | } |