blob: ce2d2a0b2488ae97fb9face4f355bd149763be19 [file] [log] [blame]
John Kessenich2f21fcc2015-06-17 16:15:09 +00001#version 130
2uniform vec4 bigColor;
3uniform vec4 bigColor1_1;
4uniform vec4 bigColor1_2;
5uniform vec4 bigColor1_3;
6uniform vec4 bigColor2;
7uniform vec4 bigColor3;
8uniform vec4 bigColor4;
9uniform vec4 bigColor5;
10uniform vec4 bigColor6;
11uniform vec4 bigColor7;
12uniform vec4 bigColor8;
13
14varying vec4 BaseColor;
15
16uniform float d;
17uniform float d2;
18uniform float d3;
19uniform float d4;
20uniform float d5;
21uniform float d6;
22uniform float d7;
23uniform float d8;
24uniform float d9;
25uniform float d10;
26uniform float d11;
27uniform float d12;
28uniform float d13;
29uniform float d14;
30uniform float d15;
31uniform float d16;
32uniform float d17;
33uniform float d18;
34uniform float d19;
35uniform float d20;
36uniform float d21;
37uniform float d22;
38uniform float d23;
39uniform float d24;
40uniform float d25;
41uniform float d26;
42uniform float d27;
43uniform float d28;
44uniform float d29;
45uniform float d30;
46uniform float d31;
47uniform float d32;
48uniform float d33;
49uniform float d34;
50
51uniform int Count;
52
53void main()
54{
55 vec4 color = BaseColor;
56
57 // Not a real loop
58 while (true) {
59 if (color.x < 0.33) {
60 color += vec4(0.33);
61 break;
62 }
63 if (color.x < 0.66) {
64 color += vec4(0.66);
65 break;
66 }
67
68 color += vec4(0.33);
69 break;
70 }
71
72 // While
73 while (color.x < d) {
74 color += bigColor;
75 }
76
77 // While (latchy)
78 while (color.z < d) {
79 color += bigColor1_1;
80 if (color.w < d)
81 continue;
82
83 color += bigColor1_1;
84 }
85
86 // While (constant)
87 while (color.x < 42.0) {
88 ++color;
89 }
90
91 // While (complicated-conditional)
92 while (color.w < d2 && color.y < d3) {
93 color += bigColor1_2;
94 }
95
96 // While (multi-exit)
97 while (color.z < d3) {
98 color += bigColor1_3;
99 if (color.y < d4)
100 break;
101 color += bigColor1_3;
102 }
103
104 // For (dynamic)
105 for (int i = 0; i < Count; ++i) {
106 color += bigColor2;
107 }
108
109 // Do while
110 do {
111 color += bigColor3;
112 } while (color.x < d2);
113
114 // For (static)
115 for (int i = 0; i < 42; ++i) {
116 color.z += d3;
117 }
118
119 // For (static) flow-control
120 for (int i = 0; i < 100; ++i) {
121 if (color.z < 20.0)
122 color.x++;
123 else
124 color.y++;
125 if (color.w < 20.0)
126 if (color.z > color.y)
127 0; // do nothing
128 }
129
130 // For (static) flow-control with latch merge
131 for (int i = 0; i < 120; ++i) {
132 if (color.z < 20.0)
133 color.x++;
134 else
135 color.y++;
136 }
137
138 // For (static) latchy
139 for (int i = 0; i < 42; ++i) {
140 color.z += d3;
141 if (color.x < d4)
142 continue;
143 ++color.w;
144 }
145
146 // For (static) multi-exit
147 for (int i = 0; i < 42; ++i) {
148 color.z += d3;
149 if (color.x < d4)
150 break;
151 ++color.w;
152 }
153
154 // Latchy
155 do {
156 color += bigColor4;
157 if (color.x < d4)
158 continue;
159 if (color.y < d4)
160 color.y += d4;
161 else
162 color.x += d4;
163 } while (color.z < d4);
164
165 // Do while flow control
166 do {
167 color += bigColor5;
168 if (color.y < d5)
169 color.y += d5;
170 } while (color.x < d5);
171
172 // If then loop
173 if (color.x < d6) {
174 while (color.y < d6)
175 color += bigColor6;
176 } else {
177 while (color.z < d6)
178 color.z += bigColor6.z;
179 }
180
181 // If then multi-exit
182 if (color.x < d6) {
183 while (color.y < d6) {
184 color += bigColor6;
185 if (d7 < 1.0)
186 break;
187 }
188
189 } else {
190 while (color.z < d6)
191 color.z += bigColor6.z;
192 }
193
194
195 // Multi-exit
196 do {
197 if (d7 < 0.0)
198 break;
199
200 color += bigColor7;
201
202 if (d7 < 1.0) {
203 color.z++;
204 break;
205 }
206
207 color += BaseColor;
208
209 } while (true);
210
211
212 // Multi-exit2
213 do {
214 // invariant conditional break at the top of the loop. This could be a
215 // situation where unswitching the loop has no real increases in code
216 // size.
217 if (d8 < 0.0)
218 break;
219
220 color += bigColor7;
221
222 if (d8 < 1.0) {
223 color.z++;
224 if (d8 < 2.0) {
225 color.y++;
226 } else {
227 color.x++;
228 }
229 break;
230 }
231
232 color += BaseColor;
233
234 } while (color.z < d8);
235
236 // Deep exit
237 while (color.w < d9) {
238 if (d9 > d8) {
239 if (color.x <= d7) {
240 if (color.z == 5.0)
241 color.w++;
242 else
243 break;
244 }
245 }
246
247 }
248
249 // No end loop-back.
250 while (color.z < d10) {
251 color.y++;
252 if (color.y < d11) {
253 color.z++;
254 if (color.w < d12)
255 color.w++;
256 else
257 color.x++;
258 continue;
259 }
260
261 color++;
262 break;
263 }
264
265 // Multi-continue
266 while (color.x < 10.0) {
267 color += bigColor8;
268
269 if (color.z < d8)
270 if (color.w < d6)
271 continue;
272
273 color.y += bigColor8.x;
274 }
275
276 color++;
277 gl_FragColor = color;
278
279 // Early Return
280 while (color.x < d14) {
281 if (color.y < d15) {
282 return;
283 }
284 else
285 color++;
286 }
287
288 color++;
289
290 while (color.w < d16) {
291 color.w++;
292 }
293
294
295 // While (complicated-conditional)
296 while (color.w < d2 && color.y < d3) {
297 color += bigColor1_2;
298 if (color.z < d3)
299 return;
300 }
301
302
303 do {
304 if (color.y < d18)
305 return;
306 color++;
307 } while (color.x < d17);
308
309 // Early Discard
310 while (color.y < d16) {
311 if (color.w < d16) {
312 discard;
313 } else
314 color++;
315 }
316
317 color++;
318
319 gl_FragColor = color;
320}