John Kessenich | 2f21fcc | 2015-06-17 16:15:09 +0000 | [diff] [blame] | 1 | #version 130
|
| 2 | uniform vec4 bigColor;
|
| 3 | uniform vec4 bigColor1_1;
|
| 4 | uniform vec4 bigColor1_2;
|
| 5 | uniform vec4 bigColor1_3;
|
| 6 | uniform vec4 bigColor2;
|
| 7 | uniform vec4 bigColor3;
|
| 8 | uniform vec4 bigColor4;
|
| 9 | uniform vec4 bigColor5;
|
| 10 | uniform vec4 bigColor6;
|
| 11 | uniform vec4 bigColor7;
|
| 12 | uniform vec4 bigColor8;
|
| 13 |
|
| 14 | varying vec4 BaseColor;
|
| 15 |
|
| 16 | uniform float d;
|
| 17 | uniform float d2;
|
| 18 | uniform float d3;
|
| 19 | uniform float d4;
|
| 20 | uniform float d5;
|
| 21 | uniform float d6;
|
| 22 | uniform float d7;
|
| 23 | uniform float d8;
|
| 24 | uniform float d9;
|
| 25 | uniform float d10;
|
| 26 | uniform float d11;
|
| 27 | uniform float d12;
|
| 28 | uniform float d13;
|
| 29 | uniform float d14;
|
| 30 | uniform float d15;
|
| 31 | uniform float d16;
|
| 32 | uniform float d17;
|
| 33 | uniform float d18;
|
| 34 | uniform float d19;
|
| 35 | uniform float d20;
|
| 36 | uniform float d21;
|
| 37 | uniform float d22;
|
| 38 | uniform float d23;
|
| 39 | uniform float d24;
|
| 40 | uniform float d25;
|
| 41 | uniform float d26;
|
| 42 | uniform float d27;
|
| 43 | uniform float d28;
|
| 44 | uniform float d29;
|
| 45 | uniform float d30;
|
| 46 | uniform float d31;
|
| 47 | uniform float d32;
|
| 48 | uniform float d33;
|
| 49 | uniform float d34;
|
| 50 |
|
| 51 | uniform int Count;
|
| 52 |
|
| 53 | void 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 | }
|