arb_program_interface_query: set vs_input2[1][0] as valid name
[piglit.git] / tests / spec / glsl-1.30 / execution / qualifiers / vs-out-conversion-ivec4-to-vec4.shader_test
blob08caf4c554eb97dc49f67c00fe4b3df73e66fe46
1 # From the GLSL 1.30 spec, p55 (Function Definitions):
3 #   For example,
5 #     vec4 f(in vec4 x, out  vec4 y);
6 #     vec4 f(in vec4 x, out ivec4 y); // okay, different argument type
7 #     ...
9 #   Calling the first two functions above with the following argument
10 #   types yields
12 #     ...
13 #     f(ivec4, vec4)  // error, convertible to both
15 # This would seem to imply that if the declaration "vec4 f(in vec4 x,
16 # out vec4 y)" were removed, the call would no longer be ambiguous,
17 # and would successfully match "vec4 f(in vec4 x, out ivec4 y)".  This
18 # test verifies that with the ambiguous declaration removed, the call
19 # does indeed match, and that the correct values are passed.
21 [require]
22 GLSL >= 1.30
24 [vertex shader]
25 #version 130
26 vec4 f(in vec4 x, out ivec4 y)
28   // Verify that the correct values were passed in.
29   if (x != vec4(1.0, 3.0, 3.0, 7.0)) {
30     // They weren't, so output zeros
31     y = ivec4(0);
32     return vec4(0.0);
33   } else {
34     // They were, so output some constants the caller can recognize.
35     y = ivec4(5, 10, 15, 20);
36     return vec4(1.0, 0.5, 0.25, 0.125);
37   }
40 void main()
42   gl_Position = gl_Vertex;
44   // Call f, passing it the input it expects.
45   ivec4 x_actual = ivec4(1, 3, 3, 7);
46   vec4 y_actual;
47   vec4 f_result = f(x_actual, y_actual);
49   // Check that the outputs are as expected.
50   if (y_actual == vec4(5.0, 10.0, 15.0, 20.0)
51       && f_result == vec4(1.0, 0.5, 0.25, 0.125)) {
52     gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0); // Green
53   } else {
54     gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0); // Red
55   }
58 [fragment shader]
59 #version 130
60 void main()
62   gl_FragColor = gl_Color;
65 [test]
66 draw rect -1 -1 2 2
67 probe all rgba 0.0 1.0 0.0 1.0