Re: [Mesa-dev] [PATCH] glsl: link error if unsized array not-last in ssbo

2017-02-17 Thread Iago Toral
Reviewed-by: Iago Toral Quiroga 

You can also add the new piglit tests that this fixes to the commit
log.

Iago 

On Wed, 2017-02-15 at 15:12 +0100, Jose Maria Casanova Crespo wrote:
> If an unsized declared array is not the last in an SSBO
> and an implicit size can not be defined on linking time,
> the linker should raise an error instead of reaching
> an assertion on GL.
> 
> This reverts part of commit 3da08e166415a745139c1127040a24e8a45dc553
> getting back to the behavior of commit
> 5b2675093e863a52b610f112884ae12d42513770
> 
> The original patch was correct for GLES that should produce
> a compile-time error but the linker error is still necessary in
> desktop GL.
> 
> Signed-off-by: Jose Maria Casanova Crespo 
> ---
>  src/compiler/glsl/link_uniform_blocks.cpp | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/link_uniform_blocks.cpp
> b/src/compiler/glsl/link_uniform_blocks.cpp
> index ba01269..839fd07 100644
> --- a/src/compiler/glsl/link_uniform_blocks.cpp
> +++ b/src/compiler/glsl/link_uniform_blocks.cpp
> @@ -146,7 +146,13 @@ private:
> */
>    const glsl_type *type_for_size = type;
>    if (type->is_unsized_array()) {
> - assert(last_field);
> + if (!last_field) {
> +linker_error(prog, "unsized array `%s' definition: "
> + "only last member of a shader storage block
> "
> + "can be defined as unsized array",
> + name);
> + }
> +
>   type_for_size = type->without_array();
>    }
>  
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: link error if unsized array not-last in ssbo

2017-02-15 Thread Chema Casanova
I've forgot the --annotate to submit this comment about this patch, so
here it is:

This patch fixes an incorrect behavior exposed by the piglit tests about
SSBOs
and unsized arrays submitted by Dave Airlie not yet in master
https://lists.freedesktop.org/archives/piglit/2016-May/019852.html

Chema

El 15/02/17 a las 15:12, Jose Maria Casanova Crespo escribió:
> If an unsized declared array is not the last in an SSBO
> and an implicit size can not be defined on linking time,
> the linker should raise an error instead of reaching
> an assertion on GL.
>
> This reverts part of commit 3da08e166415a745139c1127040a24e8a45dc553
> getting back to the behavior of commit 
> 5b2675093e863a52b610f112884ae12d42513770
>
> The original patch was correct for GLES that should produce
> a compile-time error but the linker error is still necessary in
> desktop GL.
>
> Signed-off-by: Jose Maria Casanova Crespo 
> ---
>  src/compiler/glsl/link_uniform_blocks.cpp | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/link_uniform_blocks.cpp 
> b/src/compiler/glsl/link_uniform_blocks.cpp
> index ba01269..839fd07 100644
> --- a/src/compiler/glsl/link_uniform_blocks.cpp
> +++ b/src/compiler/glsl/link_uniform_blocks.cpp
> @@ -146,7 +146,13 @@ private:
> */
>const glsl_type *type_for_size = type;
>if (type->is_unsized_array()) {
> - assert(last_field);
> + if (!last_field) {
> +linker_error(prog, "unsized array `%s' definition: "
> + "only last member of a shader storage block "
> + "can be defined as unsized array",
> + name);
> + }
> +
>   type_for_size = type->without_array();
>}
>  

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl: link error if unsized array not-last in ssbo

2017-02-15 Thread Jose Maria Casanova Crespo
If an unsized declared array is not the last in an SSBO
and an implicit size can not be defined on linking time,
the linker should raise an error instead of reaching
an assertion on GL.

This reverts part of commit 3da08e166415a745139c1127040a24e8a45dc553
getting back to the behavior of commit 5b2675093e863a52b610f112884ae12d42513770

The original patch was correct for GLES that should produce
a compile-time error but the linker error is still necessary in
desktop GL.

Signed-off-by: Jose Maria Casanova Crespo 
---
 src/compiler/glsl/link_uniform_blocks.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/link_uniform_blocks.cpp 
b/src/compiler/glsl/link_uniform_blocks.cpp
index ba01269..839fd07 100644
--- a/src/compiler/glsl/link_uniform_blocks.cpp
+++ b/src/compiler/glsl/link_uniform_blocks.cpp
@@ -146,7 +146,13 @@ private:
*/
   const glsl_type *type_for_size = type;
   if (type->is_unsized_array()) {
- assert(last_field);
+ if (!last_field) {
+linker_error(prog, "unsized array `%s' definition: "
+ "only last member of a shader storage block "
+ "can be defined as unsized array",
+ name);
+ }
+
  type_for_size = type->without_array();
   }
 
-- 
2.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev