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

Submitted by Eleni Maria Stea on June 18, 2018, 7:13 a.m.

Details

Message ID 20180618071350.1716-1-estea@igalia.com
State New
Headers show
Series "unsized_array_member: It should expect link success instead of link error" ( rev: 3 ) in Piglit

Not browsing as part of any series.

Commit Message

Eleni Maria Stea June 18, 2018, 7:13 a.m.
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(-)

Patch hide | download patch | download mbox

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

Comments

Quoting Eleni Maria Stea (2018-06-18 00:13:50)
> 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):

Please update the comment in the commit message to match the one in the code,
particularly this sentence.

> 
> "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
> 
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit