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

Ilia Mirkin imirkin at alum.mit.edu
Sat Mar 21 16:34:59 PDT 2015


On Sat, Mar 21, 2015 at 5:49 AM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
>  src/glsl/ast_to_hir.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 36f3eb7..7516e60 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -5595,7 +5595,11 @@ 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_unsized_array &&
> +              !this->array_specifier->array_dimensions.is_empty()) ||

Don't know a lot about AST, but does it make sense to have
->is_unsized_array && array_dimensions? When would that be true?
Shouldn't this just be !dim.empty() without the is_unsized_array
check?

> +             (this->array_specifier->array_dimensions.tail_pred->prev != NULL &&
> +              !this->array_specifier->array_dimensions.tail_pred->prev->is_head_sentinel())) {

Perhaps all this would be easier to read if above you wrote

foo_type *array = this->array_specifier;

Not sure. Perhaps there are some helpers to make this easier to grok?

>              _mesa_glsl_error(&loc, state,
>                               "gl_PerVertex input must be redeclared as "
>                               "gl_in[]");
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list