glsl: test function linking with implicit param conversions
[piglit.git] / tests / spec / glsl-1.20 / execution / function-match-exact-match.shader_test
blob03437343193bdd83206eba1e97a0925beaae25e2
1 /* Here we test that the linker selected the exact matching function and not
2  * the function that has implicit conversions.
3  *
4  * From page 42 (page 49 of the PDF) of the GLSL 1.20 spec:
5  *
6  * "If an exact match is found, the other signatures are ignored, and
7  *  the exact match is used.  Otherwise, if no exact match is found, then
8  *  the implicit conversions in Section 4.1.10 "Implicit Conversions" will
9  *  be applied to the calling arguments if this can make their types match
10  *  a signature.  In this case, it is a semantic error if there are
11  *  multiple ways to apply these conversions to the actual arguments of a
12  *  call such that the call can be made to match multiple signatures."
13  */
15 [require]
16 GLSL >= 1.20
18 [vertex shader]
19 void main()
21    gl_Position = gl_Vertex;
25 [fragment shader]
26 #version 120
27 vec4 get_frag_colour(int a)
29    return vec4(0.0, a, 0.0, 0.0);
32 [fragment shader]
33 #version 120
35 vec4 get_frag_colour(int a);
37 vec4 get_frag_colour(float a)
39    return vec4(a, 0.0, 0.0, 0.0);
42 void main()
44    gl_FragColor = get_frag_colour(1);
47 [test]
48 draw rect -1 -1 2 2
49 probe all rgba 0.0 1.0 0.0 0.0