[Piglit] [PATCH 1/8] GL_ARB_uniform_buffer_object: Add compiler tests for misusing UBO layouts.

Eric Anholt eric at anholt.net
Tue May 1 11:08:10 PDT 2012


---
 tests/all.tests                                    |    3 +++
 .../compiler/layout-column_major-non-uniform.frag  |   25 ++++++++++++++++++++
 .../compiler/layout-packed-non-uniform.frag        |   25 ++++++++++++++++++++
 .../compiler/layout-row_major-non-uniform.frag     |   25 ++++++++++++++++++++
 .../compiler/layout-shared-non-uniform.frag        |   25 ++++++++++++++++++++
 .../compiler/layout-std140-non-uniform.frag        |   25 ++++++++++++++++++++
 6 files changed, 128 insertions(+)
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/layout-column_major-non-uniform.frag
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/layout-packed-non-uniform.frag
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/layout-row_major-non-uniform.frag
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/layout-shared-non-uniform.frag
 create mode 100644 tests/spec/arb_uniform_buffer_object/compiler/layout-std140-non-uniform.frag

diff --git a/tests/all.tests b/tests/all.tests
index b2ff7b5..b71a42f 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1612,6 +1612,9 @@ arb_transform_feedback2['draw-auto'] = PlainExecTest(['arb_transform_feedback2-d
 
 arb_uniform_buffer_object = Group()
 spec['ARB_uniform_buffer_object'] = arb_uniform_buffer_object
+import_glsl_parser_tests(spec['ARB_uniform_buffer_object'],
+			 os.path.join(testsDir, 'spec', 'arb_uniform_buffer_object'),
+			 [''])
 arb_uniform_buffer_object['layout-std140'] = concurrent_test('arb_uniform_buffer_object-layout-std140')
 
 ati_draw_buffers = Group()
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/layout-column_major-non-uniform.frag b/tests/spec/arb_uniform_buffer_object/compiler/layout-column_major-non-uniform.frag
new file mode 100644
index 0000000..fb92756
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/layout-column_major-non-uniform.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_uniform_buffer_object_spec:
+ *
+ *     "Uniform block layout qualifiers can be declared at global
+ *      scope, on a single uniform block, or on a single block member.
+ *
+ *      At global scope, it is an error to use layout qualifiers to
+ *      declare a variable. Instead, at global scope, layout
+ *      qualifiers apply just to the keyword uniform and establish
+ *      default qualification for subsequent blocks:"
+ */
+
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(column_major) vec4 a;
+
+vec4 foo(void) {
+	return a;
+}
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/layout-packed-non-uniform.frag b/tests/spec/arb_uniform_buffer_object/compiler/layout-packed-non-uniform.frag
new file mode 100644
index 0000000..caf2dc2
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/layout-packed-non-uniform.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_uniform_buffer_object_spec:
+ *
+ *     "Uniform block layout qualifiers can be declared at global
+ *      scope, on a single uniform block, or on a single block member.
+ *
+ *      At global scope, it is an error to use layout qualifiers to
+ *      declare a variable. Instead, at global scope, layout
+ *      qualifiers apply just to the keyword uniform and establish
+ *      default qualification for subsequent blocks:"
+ */
+
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(packed) vec4 a;
+
+vec4 foo(void) {
+	return a;
+}
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/layout-row_major-non-uniform.frag b/tests/spec/arb_uniform_buffer_object/compiler/layout-row_major-non-uniform.frag
new file mode 100644
index 0000000..293fa8b
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/layout-row_major-non-uniform.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_uniform_buffer_object_spec:
+ *
+ *     "Uniform block layout qualifiers can be declared at global
+ *      scope, on a single uniform block, or on a single block member.
+ *
+ *      At global scope, it is an error to use layout qualifiers to
+ *      declare a variable. Instead, at global scope, layout
+ *      qualifiers apply just to the keyword uniform and establish
+ *      default qualification for subsequent blocks:"
+ */
+
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(row_major) vec4 a;
+
+vec4 foo(void) {
+	return a;
+}
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/layout-shared-non-uniform.frag b/tests/spec/arb_uniform_buffer_object/compiler/layout-shared-non-uniform.frag
new file mode 100644
index 0000000..8ee49eb
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/layout-shared-non-uniform.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_uniform_buffer_object_spec:
+ *
+ *     "Uniform block layout qualifiers can be declared at global
+ *      scope, on a single uniform block, or on a single block member.
+ *
+ *      At global scope, it is an error to use layout qualifiers to
+ *      declare a variable. Instead, at global scope, layout
+ *      qualifiers apply just to the keyword uniform and establish
+ *      default qualification for subsequent blocks:"
+ */
+
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(shared) vec4 a;
+
+vec4 foo(void) {
+	return a;
+}
diff --git a/tests/spec/arb_uniform_buffer_object/compiler/layout-std140-non-uniform.frag b/tests/spec/arb_uniform_buffer_object/compiler/layout-std140-non-uniform.frag
new file mode 100644
index 0000000..ff408e3
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/compiler/layout-std140-non-uniform.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_uniform_buffer_object_spec:
+ *
+ *     "Uniform block layout qualifiers can be declared at global
+ *      scope, on a single uniform block, or on a single block member.
+ *
+ *      At global scope, it is an error to use layout qualifiers to
+ *      declare a variable. Instead, at global scope, layout
+ *      qualifiers apply just to the keyword uniform and establish
+ *      default qualification for subsequent blocks:"
+ */
+
+#version 120
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(std140) vec4 a;
+
+vec4 foo(void) {
+	return a;
+}
-- 
1.7.10



More information about the Piglit mailing list