[Mesa-dev] [PATCH 08/16] glsl: dont allow gl_PerVertex to be redeclared as an array of arrays

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Jul 21 01:04:54 PDT 2015



On 18/07/15 03:25, Timothy Arceri wrote:
> V2: move single dimensionial array detection into a helper
>

s/dimensionial/dimensional

With that change,

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Sam

> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
>  src/glsl/ast.h          | 8 ++++++++
>  src/glsl/ast_to_hir.cpp | 3 ++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/glsl/ast.h b/src/glsl/ast.h
> index ef74e51..3f67907 100644
> --- a/src/glsl/ast.h
> +++ b/src/glsl/ast.h
> @@ -328,6 +328,14 @@ public:
>        array_dimensions.push_tail(&dim->link);
>     }
>  
> +   bool is_single_dimension()
> +   {
> +      return (this->is_unsized_array && this->array_dimensions.is_empty()) ||
> +         (!this->is_unsized_array &&
> +          this->array_dimensions.tail_pred->prev != NULL &&
> +          this->array_dimensions.tail_pred->prev->is_head_sentinel());
> +   }
> +
>     virtual void print(void) const;
>  
>     /* If true, this means that the array has an unsized outermost dimension. */
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index de6a86d..1e3686c 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -5670,7 +5670,8 @@ ast_interface_block::hir(exec_list *instructions,
>                               _mesa_shader_stage_to_string(state->stage));
>           }
>           if (this->instance_name == NULL ||
> -             strcmp(this->instance_name, "gl_in") != 0 || this->array_specifier == NULL) {
> +             strcmp(this->instance_name, "gl_in") != 0 || this->array_specifier == NULL ||
> +             !this->array_specifier->is_single_dimension()) {
>              _mesa_glsl_error(&loc, state,
>                               "gl_PerVertex input must be redeclared as "
>                               "gl_in[]");
> 


More information about the mesa-dev mailing list