1 # From the GLSL 1.30 spec, p55 (Function Definitions):
5 # vec4 f(in vec4 x, out vec4 y);
6 # vec4 f(in vec4 x, out ivec4 y); // okay, different argument type
9 # Calling the first two functions above with the following argument
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.
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
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);
42 gl_Position = gl_Vertex;
44 // Call f, passing it the input it expects.
45 ivec4 x_actual = ivec4(1, 3, 3, 7);
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
54 gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0); // Red
62 gl_FragColor = gl_Color;
67 probe all rgba 0.0 1.0 0.0 1.0