]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/linked_interface_mismatch.glsl
Validate location overlap and type matching for GLSL interfaces
[libs/gl.git] / tests / glsl / linked_interface_mismatch.glsl
1 uniform sampler2D tex;
2
3 #pragma MSP stage(vertex)
4 layout(location=0) in vec4 position;
5 layout(location=1) in vec4 color;
6 layout(location=2) in vec4 texcoord;
7 layout(location=0) out vec4 color_out;
8 layout(location=2) out vec4 tc_out;
9 void main()
10 {
11         gl_Position = position;
12         color_out = color;
13         tc_out = texcoord;
14 }
15
16 #pragma MSP stage(fragment)
17 layout(location=1) in vec4 color_out;
18 layout(location=2) in vec2 tc_out;
19 layout(location=0) out vec4 frag_color;
20 void main()
21 {
22         frag_color = color_out*texture(tex, tc_out);
23 }
24
25 /* Expected error:
26 <test>:17: Mismatched location 1 for 'in color_out'
27 <test>:7: Linked to 'out color_out' with location 0
28 <test>:18: Mismatched type 'vec2' for 'in tc_out'
29 <test>:8: Linked to 'out tc_out' with type 'vec4'
30 */