[Mesa-dev] [PATCH 19/19] glsl: Allow arrays of arrays in GLSL ES 3.10 and GLSL 4.30

Ilia Mirkin imirkin at alum.mit.edu
Sat Jun 20 16:35:27 PDT 2015


On Sat, Jun 20, 2015 at 8:33 AM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> ---
>  src/glsl/ast_to_hir.cpp       | 13 ++++++++-----
>  src/glsl/glsl_parser.yy       | 22 ++++++++++++++--------
>  src/glsl/glsl_parser_extras.h |  5 +++++
>  3 files changed, 27 insertions(+), 13 deletions(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 6d2dc2e..81b2765 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -1939,12 +1939,15 @@ process_array_type(YYLTYPE *loc, const glsl_type *base,
>            *
>            * "Only one-dimensional arrays may be declared."
>            */
> -         if (!state->ARB_arrays_of_arrays_enable) {
> +         if (!state->has_arrays_of_arrays()) {
> +            const char *const requirement = state->es_shader
> +               ? "GLSL ES 310"
> +               : "GL_ARB_arrays_of_array or GLSL 430";

I think everywhere I've seen it's GLSL ES 3.10 and GLSL 4.30. Also, it
should be arrays_of_array*s*

>              _mesa_glsl_error(loc, state,
> -                             "invalid array of `%s'"
> -                             "GL_ARB_arrays_of_arrays "
> -                             "required for defining arrays of arrays",
> -                             base->name);
> +                             "invalid array of `%s' "
> +                             "%s required for defining arrays of arrays",
> +                             base->name, requirement);
> +
>              return glsl_type::error_type;
>           }
>        }
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 1f08893..49c01f8 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1856,10 +1856,13 @@ array_specifier:
>        void *ctx = state;
>        $$ = $1;
>
> -      if (!state->ARB_arrays_of_arrays_enable) {
> -         _mesa_glsl_error(& @1, state,
> -                          "GL_ARB_arrays_of_arrays "
> -                          "required for defining arrays of arrays");
> +      if (!state->has_arrays_of_arrays()) {
> +         const char *const requirement = state->es_shader
> +            ? "GLSL ES 310"
> +            : "GL_ARB_arrays_of_array or GLSL 430";

Same as above.

> +         _mesa_glsl_error(& @1, state,
> +                          "%s required for defining arrays of arrays.",
> +                          requirement);
>        }
>        $$->add_dimension(new(ctx) ast_expression(ast_unsized_array_dim, NULL,
>                                                  NULL, NULL));
> @@ -1868,10 +1871,13 @@ array_specifier:
>     {
>        $$ = $1;
>
> -      if (!state->ARB_arrays_of_arrays_enable) {
> -         _mesa_glsl_error(& @1, state,
> -                          "GL_ARB_arrays_of_arrays "
> -                          "required for defining arrays of arrays");
> +      if (!state->has_arrays_of_arrays()) {
> +         const char *const requirement = state->es_shader
> +            ? "GLSL ES 310"
> +            : "GL_ARB_arrays_of_array or GLSL 430";

and again.

> +         _mesa_glsl_error(& @1, state,
> +                          "%s required for defining arrays of arrays.",
> +                          requirement);
>        }
>
>        $$->add_dimension($3);
> diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
> index 9a0c24e..21182e4 100644
> --- a/src/glsl/glsl_parser_extras.h
> +++ b/src/glsl/glsl_parser_extras.h
> @@ -190,6 +190,11 @@ struct _mesa_glsl_parse_state {
>        return true;
>     }
>
> +   bool has_arrays_of_arrays() const
> +   {
> +      return ARB_arrays_of_arrays_enable || is_version(430, 310);
> +   }
> +
>     bool has_atomic_counters() const
>     {
>        return ARB_shader_atomic_counters_enable || is_version(420, 310);
> --
> 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