[Piglit] [PATCH 04/14] Test that interface blocks cannot declare conflicting names.

Paul Berry stereotype441 at gmail.com
Wed Oct 2 16:45:32 PDT 2013


---
 ...nterface-block-conflicts-with-ordinary-var.vert | 21 +++++++++++++++
 ...-block-elem-conflicts-with-prev-block-elem.vert | 30 ++++++++++++++++++++++
 ...face-block-elem-conflicts-with-prev-global.vert | 28 ++++++++++++++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert
 create mode 100644 tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert
 create mode 100644 tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert

diff --git a/tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert b/tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert
new file mode 100644
index 0000000..08096df
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+//
+// This test checks that once a variable has been declared, the name
+// of that variable can't be re-used as an instance name for a named
+// interface block.
+
+#version 150
+
+out vec4 foo;
+
+out block {
+    vec4 a;
+} foo;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert
new file mode 100644
index 0000000..c26c82d
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+//
+// From section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec:
+//
+//     If an instance name (instance-name) is not used, the names
+//     declared inside the block are scoped at the global level and
+//     accessed as if they were declared outside the block.
+//
+// Consequently, inside an interface block lacking an instance-name,
+// it is illegal to use a name that was previously declared inside a
+// different interface block lacking an instance-name (just as it
+// would be illegal to redeclare the name outside an interface block).
+
+#version 150
+
+out block1 {
+    vec4 a;
+};
+
+out block2 {
+    vec4 a;
+};
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert
new file mode 100644
index 0000000..968eeeb
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+//
+// From section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec:
+//
+//     If an instance name (instance-name) is not used, the names
+//     declared inside the block are scoped at the global level and
+//     accessed as if they were declared outside the block.
+//
+// Consequently, inside an interface block lacking an instance-name,
+// it is illegal to use a name that was previously declared outside
+// any interface block (just as it would be illegal to redeclare the
+// name outside an interface block).
+
+#version 150
+
+vec4 a;
+
+out block {
+    vec4 a;
+};
+
+void main()
+{
+}
-- 
1.8.4



More information about the Piglit mailing list