[Piglit] [PATCH v3] unsized_array_member: It should expect link success instead of link error

Eleni Maria Stea estea at igalia.com
Mon Jun 18 07:13:50 UTC 2018


Modified the unsized_array_member.shader_test to expect successful
linking instead of linker error.

According to the GLSLang Specification (version 4.60 Section 4.2 Scoping):

"An array implicitly sized in one shader can be explicitly sized by
another shader in the same stage. If no shader in a stage has an explicit
size for the array, the largest implicit size (one more than the largest
index used) in that stage is used. There is no cross-stage array sizing.
If there is no static access to an implicitly sized array within the stage
declaring it, then the array is given a size of 1, which is relevant when
the array is declared within an interface block that is shared with other
stages or the application (other unused arrays might be eliminated by the
optimizer)."

This means that the unused array s of the following shader block in the
unsized_array_member.shader_test:
buffer a {
	vec4 s[];
	vec4 a[];
} b;
should be an array of size 1 and not an unsized array, and so no linker
error should be generated.

Ref: https://bugs.freedesktop.org/show_bug.cgi?id=106915

v2:
  - replaces the comment at the top with the relevant part of the spec
---
 .../linker/unsized_array_member.shader_test   | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

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
index 47d0483ac..946bf1cb2 100644
--- 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
@@ -1,12 +1,14 @@
-# From ARB_program_interface_query spec:
+# Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
 #
-#    "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."
+#    "An array implicitly sized in one shader can be explicitly sized by
+#    another shader in the same stage. If no shader in a stage has an
+#    explicit size for the array, the largest implicit size (one more than
+#    the largest index used) in that stage is used. There is no cross-stage
+#    array sizing. If there is no static access to an implicitly sized array
+#    within the stage declaring it, then the array is given a size of 1,
+#    which is relevant when the array is declared within an interface block
+#    that is shared with other stages or the application (other unused arrays
+#    might be eliminated by the optimizer)."
 
 [require]
 GLSL >= 1.50
@@ -31,4 +33,4 @@ void main(void) {
 }
 
 [test]
-link error
+link success
-- 
2.17.1



More information about the Piglit mailing list