[Piglit] [PATCH] arb_shader_storage_buffer_object: test unsized vs implicit arrays.

Dave Airlie airlied at gmail.com
Wed May 25 03:31:20 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This tests the difference between an unsized and an implicitly sized array

This removes a compiler test as this will be a linker error now.

The rules are you can have a [] array as long as the shader
later implicitly sizes it.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 .../unsized-array-not-in-last-position.frag        | 24 ---------------
 .../linker/implicit_size_array_member.shader_test  | 34 +++++++++++++++++++++
 .../non_integral_size_array_member.shader_test     | 35 ++++++++++++++++++++++
 .../linker/unsized_array_member.shader_test        | 34 +++++++++++++++++++++
 4 files changed, 103 insertions(+), 24 deletions(-)
 delete mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/linker/implicit_size_array_member.shader_test
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/linker/non_integral_size_array_member.shader_test
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test

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
deleted file mode 100644
index 073d3f3..0000000
--- a/tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag
+++ /dev/null
@@ -1,24 +0,0 @@
-// [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;
-}
diff --git a/tests/spec/arb_shader_storage_buffer_object/linker/implicit_size_array_member.shader_test b/tests/spec/arb_shader_storage_buffer_object/linker/implicit_size_array_member.shader_test
new file mode 100644
index 0000000..03b2b7c
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/linker/implicit_size_array_member.shader_test
@@ -0,0 +1,34 @@
+# From ARB_program_interface_query spec:
+#
+#    "For the property of BUFFER_DATA_SIZE, then the implementation-dependent
+#    minimum total buffer object size, in basic machine units, required to
+#    hold all active variables associated with an active uniform block, shader
+#    storage block, or atomic counter buffer is written to <params>.  If the
+#    final member of an active shader storage block is array with no declared
+#    size, the minimum buffer size is computed assuming the array was declared
+#    as an array with one element."
+
+[require]
+GLSL >= 1.50
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer a {
+	vec4 s[];
+	vec4 a[];
+} b;
+
+in vec4 piglit_vertex;
+out vec4 c;
+
+void main(void) {
+	c = b.s[0] + b.s[1];
+
+	gl_Position = piglit_vertex;
+}
+
+[test]
+verify program_interface_query GL_SHADER_STORAGE_BLOCK a GL_BUFFER_DATA_SIZE 48
diff --git a/tests/spec/arb_shader_storage_buffer_object/linker/non_integral_size_array_member.shader_test b/tests/spec/arb_shader_storage_buffer_object/linker/non_integral_size_array_member.shader_test
new file mode 100644
index 0000000..ba9c605
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/linker/non_integral_size_array_member.shader_test
@@ -0,0 +1,35 @@
+# From ARB_program_interface_query spec:
+#
+#    "For the property of BUFFER_DATA_SIZE, then the implementation-dependent
+#    minimum total buffer object size, in basic machine units, required to
+#    hold all active variables associated with an active uniform block, shader
+#    storage block, or atomic counter buffer is written to <params>.  If the
+#    final member of an active shader storage block is array with no declared
+#    size, the minimum buffer size is computed assuming the array was declared
+#    as an array with one element."
+
+[require]
+GLSL >= 1.50
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer a {
+	vec4 s[];
+	vec4 a[];
+} b;
+
+uniform int f;
+in vec4 piglit_vertex;
+out vec4 c;
+
+void main(void) {
+	c = b.s[f];
+
+	gl_Position = piglit_vertex;
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
new file mode 100644
index 0000000..47d0483
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
@@ -0,0 +1,34 @@
+# From ARB_program_interface_query spec:
+#
+#    "For the property of BUFFER_DATA_SIZE, then the implementation-dependent
+#    minimum total buffer object size, in basic machine units, required to
+#    hold all active variables associated with an active uniform block, shader
+#    storage block, or atomic counter buffer is written to <params>.  If the
+#    final member of an active shader storage block is array with no declared
+#    size, the minimum buffer size is computed assuming the array was declared
+#    as an array with one element."
+
+[require]
+GLSL >= 1.50
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer a {
+	vec4 s[];
+	vec4 a[];
+} b;
+
+in vec4 piglit_vertex;
+out vec4 c;
+
+void main(void) {
+	c = b.a[0];
+
+	gl_Position = piglit_vertex;
+}
+
+[test]
+link error
-- 
2.5.5



More information about the Piglit mailing list