]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/uniform_block_mismatch.glsl
Offset layout qualifiers are only allowed on uniform block members
[libs/gl.git] / tests / glsl / uniform_block_mismatch.glsl
1 #pragma MSP stage(vertex)
2 layout(binding=0) uniform Transform
3 {
4         mat4 model;
5         mat4 vp;
6 };
7 layout(binding=1) uniform Lighting
8 {
9         vec3 position;
10 } light;
11 layout(location=0) in vec4 position;
12 layout(location=1) in vec3 normal;
13 void main()
14 {
15         vec4 world_pos = model*position;
16         gl_Position = vp*world_pos;
17         out vec3 light_dir = world_pos.xyz-light.position;
18         passthrough;
19 }
20
21 #pragma MSP stage(fragment)
22 layout(binding=1) uniform Lighting
23 {
24         vec4 color;
25 } light;
26 layout(binding=0) uniform Material
27 {
28         vec4 color;
29 };
30 layout(location=0) out vec4 frag_color;
31 void main()
32 {
33         frag_color = color*vec4(vec3(max(dot(normalize(normal), normalize(light_dir)), 0.0)), 1.0);
34 }
35
36 /* Expected error:
37 <test>:23: Mismatched structure for uniform 'Lighting'
38 <test>:8: Previously declared here
39 <test>:27: Overlapping binding 0 for 'Material'
40 <test>:3: Previously used here for 'Transform'
41 */