]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/uniform_mismatch.glsl
Even more validation for uniform mismatches
[libs/gl.git] / tests / glsl / uniform_mismatch.glsl
1 #pragma MSP stage(vertex)
2 layout(binding=0) uniform sampler2D heightmap;
3 layout(location=0) uniform mat4 mvp;
4 layout(location=0) in vec2 position;
5 layout(location=1) in vec3 texcoord;
6 void main()
7 {
8         gl_Position = mvp*vec4(position, texture(heightmap, texcoord.xy).r, 1.0);
9         passthrough;
10 }
11
12 #pragma MSP stage(fragment)
13 layout(binding=1) uniform sampler2DArray heightmap;
14 layout(location=3) uniform vec4 color;
15 layout(location=0) out vec4 frag_color;
16 void main()
17 {
18         frag_color = color*texture(heightmap, texcoord).r;
19 }
20
21 /* Expected error:
22 <test>:13: Mismatched binding 1 for uniform 'heightmap'
23 <test>:2: Previously declared here with binding 0
24 <test>:13: Mismatched type 'sampler2DArray' for uniform 'heightmap'
25 <test>:2: Previously declared here with type 'sampler2D'
26 <test>:14: Overlapping location 3 for 'color'
27 <test>:3: Previously used here for 'mvp'
28 */