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

Ilia Mirkin imirkin at alum.mit.edu
Wed Jul 29 07:04:46 PDT 2015


This patch is

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Wed, Jul 29, 2015 at 9:57 AM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> V2: add missing 's' to the extension name in error messages
>  and add decimal place in version string
> ---
>  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 595bc5b..403aa02 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -1996,12 +1996,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 3.10"
> +               : "GL_ARB_arrays_of_arrays or GLSL 4.30";
>              _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 2218718..77c458c 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1966,10 +1966,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 3.10"
> +            : "GL_ARB_arrays_of_arrays or GLSL 4.30";
> +         _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));
> @@ -1978,10 +1981,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 3.10"
> +            : "GL_ARB_arrays_of_arrays or GLSL 4.30";
> +         _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 eb325f0..d11fadb 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.4.3
>
> _______________________________________________
> 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