perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.30 / execution / fs-large-local-array-out-of-bounds-write.shader_test
blob72761ff22bffd2a1888f3566909a7108f9c5c976
1 /* From section 5.7 "Structure and Array Operations" of the GLSL 1.30 spec:
2  *
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."
5  *
6  * The behaviour becomes defined only in robustness extensions, however even
7  * if driver is technically allowed to crash or hang, it most likely
8  * doesn't want to.
9  *
10  * Large local array may be spilled, so out-of-bounds access should be tested
11  * for them separately.
12  */
14 [require]
15 GLSL >= 1.30
17 [vertex shader passthrough]
19 [fragment shader]
21 uniform int i1 = 0;
22 uniform int i2 = 0;
24 void main()
26         int large_arr[512]; // Large enough to require spilling on most GPUs
28         int idx1 = -1;
29         large_arr[idx1] = 1;
31         int idx2 = 2147483647;
32         large_arr[idx2] = 1;
34         int idx3 = 2147483647;
35         large_arr[idx3 > 0 ? idx3 : -1] = 1;
37         int idx4 = -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];
46 [test]
47 draw rect -1 -1 2 2