glsl-array-bounds: set out-of-bounds array index inside shader
[piglit.git] / tests / shaders / glsl-fs-vec4-indexing-temp-src-in-nested-loop-inner.shader_test
blob4d3d70bfb31c30bb11ce312f1417535f215c721e
1 [require]
2 GLSL >= 1.10
4 [vertex shader]
5 void main()
7     gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
10 [fragment shader]
11 uniform float one;
12 uniform int count1, count2;
14 void main()
16     vec4 array[8];
17     array[0] = vec4(0.1, 0,   0,   0) * one;
18     array[1] = vec4(0,   0.1, 0,   0) * one;
19     array[2] = vec4(0,   0,   0.1, 0) * one;
20     array[3] = vec4(0,   0.1, 0,   0) * one;
21     array[4] = vec4(0,   0  , 0.1, 0) * one;
22     array[5] = vec4(0,   0,   0.1, 0) * one;
23     array[6] = vec4(0.1, 0,   0,   0) * one;
24     array[7] = vec4(0,   0.1, 0,   0) * one;
25     vec4 res = vec4(0);
26     for (int i = 0; i < count1; i++)
27         for (int j = 0; j < count2; j++)
28             res += array[j];
29     gl_FragColor = res;
32 [test]
33 ortho
34 clear color 0.5 0.5 0.5 0.5
35 clear
36 uniform float one 1
38 uniform int count1 0
39 uniform int count2 0
40 draw rect 10 10 10 10
41 probe rgb 15 15 0 0 0
43 uniform int count1 1
44 uniform int count2 1
45 draw rect 30 10 10 10
46 probe rgb 35 15 0.1 0 0
48 uniform int count1 1
49 uniform int count2 3
50 draw rect 50 10 10 10
51 probe rgb 55 15 0.1 0.1 0.1
53 uniform int count1 3
54 uniform int count2 1
55 draw rect 70 10 10 10
56 probe rgb 75 15 0.3 0 0
58 uniform int count1 3
59 uniform int count2 2
60 draw rect 90 10 10 10
61 probe rgb 95 15 0.3 0.3 0
63 uniform int count1 2
64 uniform int count2 4
65 draw rect 110 10 10 10
66 probe rgb 115 15 0.2 0.4 0.2
68 uniform int count1 5
69 uniform int count2 2
70 draw rect 130 10 10 10
71 probe rgb 135 15 0.5 0.5 0
73 uniform int count1 3
74 uniform int count2 8
75 draw rect 150 10 10 10
76 probe rgb 155 15 0.6 0.9 0.9
78 uniform int count1 5
79 uniform int count2 5
80 draw rect 170 10 10 10
81 probe rgb 175 15 0.5 1 1
83 uniform int count1 2
84 uniform int count2 7
85 draw rect 190 10 10 10
86 probe rgb 195 15 0.4 0.4 0.6