[Piglit] [PATCH 1/4] GLSL 1.50 Interface blocks: Test that block array sizes must match between shaders

Nicholas Mack nichmack at gmail.com
Fri Sep 27 11:28:50 PDT 2013


---
 ...ce-blocks-vs-fs-array-size-mismatch.shader_test | 37 +++++++++++++++++++
 ...ce-blocks-vs-gs-array-size-mismatch.shader_test | 41 ++++++++++++++++++++++
 2 files changed, 78 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test

diff --git a/tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test
new file mode 100644
index 0000000..c9e4834
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-blocks-vs-fs-array-size-mismatch.shader_test
@@ -0,0 +1,37 @@
+# Test interface blocks declared as arrays must match array sizes.
+#
+# GLSLangSpec.1.50.11, 4.3.7 Interface Blocks:
+# "if a matching block is declared as an array, then the array sizes must
+#  also match"
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+
+out block {
+    vec4 a;
+    vec4 b;
+} vs_block[3];
+
+void main()
+{
+	for(int i = 0; i < 3; i++) {
+		vs_block[i].a = vec4(1., 0., 0., 1.);
+	}
+}
+
+[fragment shader]
+in block {
+    vec4 a;
+    vec4 b;
+} fs_block[2]; //different array size should fail to link
+
+out vec4 color;
+
+void main()
+{
+	color = fs_block[0].a;
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test
new file mode 100644
index 0000000..5581ba8
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test
@@ -0,0 +1,41 @@
+# Test interface blocks declared as arrays must match array sizes.
+#
+# GLSLangSpec.1.50.11, 4.3.7 Interface Blocks:
+# "if a matching block is declared as an array, then the array sizes must
+#  also match"
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out block {
+    vec4 a;
+    vec4 b;
+} vs_block[3];
+
+void main()
+{
+	for(int i = 0; i < 3; i++) {
+		vs_block[i].a = vec4(1., 0., 0., 1.);
+	}
+}
+
+[geometry shader]
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+
+in block {
+    vec4 a;
+    vec4 b;
+} vs_block[];
+
+out vec4 color;
+
+void main()
+{
+	for(int i = 0; i < 2; i++) {
+		color = vs_block[i].a;
+	}
+}
+
+[test]
+link error
-- 
1.8.3.1



More information about the Piglit mailing list