[Piglit] [PATCH 1/2] arb_uniform_buffer_object: Add serveral tests related to block names

Ian Romanick idr at freedesktop.org
Sat Dec 8 12:48:02 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

The spec says that the name of a uniform block is in the same scope as
other symbols.  Verify that.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
---
 .../compiler/block-name-clashes-with-function.vert | 27 ++++++++++++++++++++++
 .../compiler/block-name-clashes-with-struct.vert   | 26 +++++++++++++++++++++
 .../compiler/block-name-clashes-with-variable.vert | 24 +++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-function.vert
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-struct.vert
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-variable.vert

diff --git a/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-function.vert b/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-function.vert
new file mode 100644
index 0000000..e8d9dc4
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-function.vert
@@ -0,0 +1,27 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_uniform_buffer_object
+ * [end config]
+ *
+ * Page 31 (page 37 of the PDF) of the GLSL 1.40 spec says:
+ *
+ *     "Uniform block names and variable names declared within uniform blocks
+ *     are scoped at the program level."
+ */
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+uniform a {
+  vec4 b;
+};
+
+float a(void)
+{
+  return b.x;
+}
+
+void main()
+{
+  gl_Position = b;
+}
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-struct.vert b/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-struct.vert
new file mode 100644
index 0000000..557cbc5
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-struct.vert
@@ -0,0 +1,26 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_uniform_buffer_object
+ * [end config]
+ *
+ * Page 31 (page 37 of the PDF) of the GLSL 1.40 spec says:
+ *
+ *     "Uniform block names and variable names declared within uniform blocks
+ *     are scoped at the program level."
+ */
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+uniform a {
+  vec4 b;
+};
+
+struct a {
+  vec4 c;
+};
+
+void main()
+{
+  gl_Position = b;
+}
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-variable.vert b/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-variable.vert
new file mode 100644
index 0000000..a5b3b2f
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/block-name-clashes-with-variable.vert
@@ -0,0 +1,24 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_uniform_buffer_object
+ * [end config]
+ *
+ * Page 31 (page 37 of the PDF) of the GLSL 1.40 spec says:
+ *
+ *     "Uniform block names and variable names declared within uniform blocks
+ *     are scoped at the program level."
+ */
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+uniform a {
+  vec4 b;
+};
+
+float a;
+
+void main()
+{
+  gl_Position = b;
+}
-- 
1.7.11.7



More information about the Piglit mailing list