summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-05-25 13:26:42 +1000
committerDave Airlie <airlied@redhat.com>2016-06-08 05:12:36 +1000
commite1346235cff76959af90132767b26fd25bd6c147 (patch)
treec0c3e99a368e208edc02bed96bccda90ffecf4bb
parentb49eebda5a809617bc5608945e2cc3685e63ebdd (diff)
arb_shader_storage_buffer_object: test unsized vs implicit arrays.
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@redhat.com>
-rw-r--r--tests/spec/arb_shader_storage_buffer_object/compiler/unsized-array-not-in-last-position.frag24
-rw-r--r--tests/spec/arb_shader_storage_buffer_object/linker/implicit_size_array_member.shader_test34
-rw-r--r--tests/spec/arb_shader_storage_buffer_object/linker/non_integral_size_array_member.shader_test35
-rw-r--r--tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test34
4 files changed, 103 insertions, 24 deletions
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 073d3f324..000000000
--- 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 000000000..03b2b7c2e
--- /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 000000000..ba9c60538
--- /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 000000000..47d0483ac
--- /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