[Mesa-dev] [PATCH] glsl: check if implicitly sized arrays dont match explicitly sized arrays across the same stage

Timothy Arceri t_arceri at yahoo.com.au
Tue Nov 25 12:27:59 PST 2014


Whoops I edited the wrong patch before sending this out it was meant to
be RFC and have the following comments attached:

 I came across this when I was writting arrays of arrays piglit tests.
 This change fixes the new link error single dimension array
 tests I sent to the piglit list [1].

 I've sent this as RFC as the error message needs some work
 currently it says "shader output `color' declared as type `vec4[2]' and
  type `vec4[]'" any suggestions on how this should be reworded would be
 helpful (keeping in mind it will also need to apply to arrays of
arrays).

 I've also run all the glsl piglit tests without any regressions.

 [1]
http://lists.freedesktop.org/archives/piglit/2014-November/013478.html

On Tue, 2014-11-25 at 23:32 +1100, Timothy Arceri wrote:
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
>  src/glsl/linker.cpp | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index de6b1fb..a3a43a0 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -732,8 +732,25 @@ cross_validate_globals(struct gl_shader_program *prog,
>  		   && ((var->type->length == 0)
>  		       || (existing->type->length == 0))) {
>  		  if (var->type->length != 0) {
> +                     if (var->type->length <= existing->data.max_array_access) {
> +                        linker_error(prog, "%s `%s' declared as type "
> +                                     "`%s' and type `%s'\n",
> +                                     mode_string(var),
> +                                     var->name, var->type->name,
> +                                     existing->type->name);
> +                        return;
> +                     }
>  		     existing->type = var->type;
> -		  }
> +		  } else if (existing->type->length != 0
> +                             && existing->type->length <=
> +                                var->data.max_array_access) {
> +                     linker_error(prog, "%s `%s' declared as type "
> +                                  "`%s' and type `%s'\n",
> +                                  mode_string(var),
> +                                  var->name, existing->type->name,
> +                                  var->type->name);
> +                     return;
> +                  }
>                 } else if (var->type->is_record()
>  		   && existing->type->is_record()
>  		   && existing->type->record_compare(var->type)) {




More information about the mesa-dev mailing list