[Piglit] [PATCH 02/13] arb_shader_storage_buffer_object: add compiler tests
Samuel Iglesias Gonsalvez
siglesias at igalia.com
Wed May 13 23:17:14 PDT 2015
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
.../extension-disabled-shader-storage-block.frag | 15 +++++++++++
.../compiler/extension-disabled-std430.frag | 13 ++++++++++
.../compiler/layout-std430-non-shader-storage.frag | 24 ++++++++++++++++++
.../compiler/layout-std430-within-block.frag | 22 ++++++++++++++++
.../compiler/shader-storage-block-initializer.frag | 21 ++++++++++++++++
.../compiler/shader-storage-block-sampler.frag | 23 +++++++++++++++++
.../compiler/shader-storage-outside-block.frag | 20 +++++++++++++++
.../compiler/unsized-array-argument-function.frag | 29 ++++++++++++++++++++++
.../unsized-array-not-in-last-position.frag | 24 ++++++++++++++++++
9 files changed, 191 insertions(+)
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-sampler.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-outside-block.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-argument-function.frag
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
new file mode 100644
index 0000000..de19757
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-shader-storage-block.frag
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: disable
+
+buffer ssbo {
+ vec4 a;
+};
+
+void foo(void) {
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
new file mode 100644
index 0000000..3ac7a58
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/extension-disabled-std430.frag
@@ -0,0 +1,13 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: disable
+
+layout(std430) buffer;
+
+void foo(void) {
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
new file mode 100644
index 0000000..309a18f
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-non-shader-storage.frag
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object GL_ARB_uniform_buffer_object
+// [end config]
+
+/* From the GL_ARB_shader_storage_buffer_object:
+ *
+ * "The std430 qualifier is supported only for shader storage blocks;
+ * a shader using the std430 qualifier on a uniform block will fail to
+ * compile."
+ */
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_uniform_buffer_object: require
+
+layout(std430) uniform Ubo {
+ vec4 b;
+};
+
+vec4 foo(void) {
+ return b;
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
new file mode 100644
index 0000000..1161248
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/layout-std430-within-block.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+/* From the GL_ARB_shader_storage_buffer_object:
+ *
+ * "Layout qualifiers on member declarations cannot use the shared,
+ * packed, std140, or std430 qualifiers."
+ */
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer ssbo {
+ layout(std430) vec4 a;
+};
+
+vec4 foo(void) {
+ return a;
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag
new file mode 100644
index 0000000..c8c9762
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-initializer.frag
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+/* From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ * "Buffer variables cannot have initializers"
+ */
+
+buffer a {
+ vec4 b = vec4(1.0);
+};
+
+vec4 foo(void) {
+ return b;
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-sampler.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-sampler.frag
new file mode 100644
index 0000000..9eaaa74
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-block-sampler.frag
@@ -0,0 +1,23 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+/* From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ * "The "buffer" qualifier can be used with any of the basic data types, or
+ * when declaring a variable whose type is a structure, or an array of any of
+ * these."
+ */
+
+buffer a {
+ sampler2D s;
+};
+
+vec4 foo(void) {
+ return texture2D(s, vec2(0.0));
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-outside-block.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-outside-block.frag
new file mode 100644
index 0000000..31c2b31
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/shader-storage-outside-block.frag
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+/* From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ * "It is illegal to declare buffer variables at global scope
+ * (outside a block)."
+ */
+
+buffer vec4 a;
+
+vec4 foo(void) {
+ return a;
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-argument-function.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-argument-function.frag
new file mode 100644
index 0000000..7a852f3
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-argument-function.frag
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+/* From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ * "Such unsized arrays may be indexed with general integer expressions, but
+ * may not be passed as an argument to a function or indexed with a negative
+ * constant expression."
+ */
+
+buffer a {
+ int s[];
+};
+
+int foo(int array[2]) {
+ return array[0];
+}
+
+void main(void)
+{
+ s[1] = int(0);
+ int val = foo(s);
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag
new file mode 100644
index 0000000..073d3f3
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_shader_storage_buffer_object
+// [end config]
+
+#version 120
+#extension GL_ARB_shader_storage_buffer_object: require
+
+/* From the GL_ARB_shader_storage_buffer_object spec:
+ *
+ * "In a shader storage block, the last member may be declared without an
+ * explicit size."
+ */
+
+buffer a {
+ vec4 b;
+ int c[];
+ float d;
+};
+
+vec4 foo(void) {
+ return b;
+}
--
2.1.0
More information about the Piglit
mailing list