glsl-1.20: move a bunch of shaders to the glsl-1.20 dir
[piglit.git] / tests / spec / glsl-1.20 / execution / fs-function-inout-array-of-structs.shader_test
blobe0af00d7477eadac163e02c0f407532324f84c38
1 # Test inout arrays of structs passed to functions.
3 [require]
4 GLSL >= 1.20
6 [vertex shader passthrough]
8 [fragment shader]
9 #version 120
11 struct S {
12         ivec4 v;
15 void multiply(inout S array[4])
17         for (int i = 0; i < 4; ++i) {
18                 array[i].v *= i;
19         }
22 void main()
24         S array[4];
26         for (int i = 0; i < 4; ++i)
27                 array[i].v = ivec4(0, 1, 2, 3);
29         multiply(array);
31         for (int i = 0; i < 4; ++i) {
32                 if (array[i].v.x != 0) {
33                         gl_FragColor = vec4(1.0, 0.0, float(i) / 255.0, float(array[i].v.x) / 255.0);
34                         return;
35                 }
36                 if (array[i].v.y != 1 * i) {
37                         gl_FragColor = vec4(1.0, 0.1, float(i) / 255.0, float(array[i].v.y) / 255.0);
38                         return;
39                 }
40                 if (array[i].v.z != 2 * i) {
41                         gl_FragColor = vec4(1.0, 0.2, float(i) / 255.0, float(array[i].v.z) / 255.0);
42                         return;
43                 }
44                 if (array[i].v.w != 3 * i) {
45                         gl_FragColor = vec4(1.0, 0.3, float(i) / 255.0, float(array[i].v.w) / 255.0);
46                         return;
47                 }
48         }
50         gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
53 [test]
54 draw rect -1 -1 2 2
55 probe all rgba 0.0 1.0 0.0 1.0