]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/uniform_mismatch.glsl
Even more validation for uniform mismatches
[libs/gl.git] / tests / glsl / uniform_mismatch.glsl
diff --git a/tests/glsl/uniform_mismatch.glsl b/tests/glsl/uniform_mismatch.glsl
new file mode 100644 (file)
index 0000000..de5c08b
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma MSP stage(vertex)
+layout(binding=0) uniform sampler2D heightmap;
+layout(location=0) uniform mat4 mvp;
+layout(location=0) in vec2 position;
+layout(location=1) in vec3 texcoord;
+void main()
+{
+       gl_Position = mvp*vec4(position, texture(heightmap, texcoord.xy).r, 1.0);
+       passthrough;
+}
+
+#pragma MSP stage(fragment)
+layout(binding=1) uniform sampler2DArray heightmap;
+layout(location=3) uniform vec4 color;
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       frag_color = color*texture(heightmap, texcoord).r;
+}
+
+/* Expected error:
+<test>:13: Mismatched binding 1 for uniform 'heightmap'
+<test>:2: Previously declared here with binding 0
+<test>:13: Mismatched type 'sampler2DArray' for uniform 'heightmap'
+<test>:2: Previously declared here with type 'sampler2D'
+<test>:14: Overlapping location 3 for 'color'
+<test>:3: Previously used here for 'mvp'
+*/