1 /* From section 5.7 "Structure and Array Operations" of the GLSL 1.30 spec:
3 * "Behavior is undefined if a shader subscripts an array with an index less
4 * than 0 or greater than or equal to the size the array was declared with."
6 * The behaviour becomes defined only in robustness extensions, however even
7 * if driver is technically allowed to crash or hang, it most likely
10 * Large local array may be spilled, so out-of-bounds access should be tested
11 * for them separately.
17 [vertex shader passthrough]
26 int large_arr[512]; // Large enough to require spilling on most GPUs
31 int idx2 = 2147483647;
34 int idx3 = 2147483647;
35 large_arr[idx3 > 0 ? idx3 : -1] = 1;
38 large_arr[idx4 * idx4 * idx4] = 1;
40 large_arr[i1] = 5; // Prevent driver from optimizing out the array
42 gl_FragColor.gba = vec3(1.0, 1.0, 1.0);
43 gl_FragColor.r = large_arr[i2];