summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-10-29 13:14:02 -0700
committerPaul Berry <stereotype441@gmail.com>2013-11-11 15:09:22 -0800
commit7c528ff3e492e72a8c4748421da24268a510449c (patch)
tree142cef4bcc233cf9e79b3d4b4bc2c8d8c723ac6b
parent79f9ac3be26f63ae7aa5a1c69a01b80072e8af2f (diff)
Test intrastage interface block array matching rules.
Note: as of Mesa 5cb80f0, test "intrastage-interface-unnamed-array" is known to fail. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test42
-rw-r--r--tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test47
-rw-r--r--tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test47
3 files changed, 136 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test b/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test
new file mode 100644
index 00000000..b1f60fc1
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test
@@ -0,0 +1,42 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that a link error is generated if intrastage
+# array sizes don't match.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+ vec4 foo;
+} inst[2];
+
+void f()
+{
+ inst[1].foo = vec4(1.0);
+}
+
+[vertex shader]
+out blk {
+ vec4 foo;
+} inst[3];
+
+void f();
+
+void main()
+{
+ f();
+ inst[2].foo = vec4(1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test b/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test
new file mode 100644
index 00000000..a8ef627b
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test
@@ -0,0 +1,47 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# Although it's not explicitly stated, it's clear that when doing
+# intrastage linking, interface block arrays can only match other
+# interface block arrays.
+#
+# This test verifies that a link error occurs if we try to do
+# intrastage linking of a named interface block to an interface block
+# array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+ vec4 foo;
+} inst;
+
+void f()
+{
+ inst.foo = vec4(1.0);
+}
+
+[vertex shader]
+out blk {
+ vec4 foo;
+} inst[3];
+
+void f();
+
+void main()
+{
+ f();
+ inst[2].foo = vec4(1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test b/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test
new file mode 100644
index 00000000..1dee9989
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test
@@ -0,0 +1,47 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# Although it's not explicitly stated, it's clear that when doing
+# intrastage linking, interface block arrays can only match other
+# interface block arrays.
+#
+# This test verifies that a link error occurs if we try to do
+# intrastage linking of an unnamed interface block to an interface
+# block array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+ vec4 foo;
+};
+
+void f()
+{
+ foo = vec4(1.0);
+}
+
+[vertex shader]
+out blk {
+ vec4 foo;
+} inst[3];
+
+void f();
+
+void main()
+{
+ f();
+ inst[2].foo = vec4(1.0);
+}
+
+[test]
+link error