[Mesa-dev] [PATCH 16/16] glsl: Allow arrays of arrays in GLSL ES 3.10 and GLSL 4.30
Lofstedt, Marta
marta.lofstedt at intel.com
Thu Sep 3 00:55:04 PDT 2015
Hi Timothy,
This patch will unlock a lot of GLES 3.1 AoA related CTS tests. It would be nice to see it merged.
Reviewed-by: Marta Lofstedt <marta.lofstedt at intel.com>
> -----Original Message-----
> From: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] On
> Behalf Of Timothy Arceri
> Sent: Saturday, July 18, 2015 3:26 AM
> To: mesa-dev at lists.freedesktop.org
> Subject: [Mesa-dev] [PATCH 16/16] glsl: Allow arrays of arrays in GLSL ES 3.10
> and GLSL 4.30
>
> 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
> 8154c1e..fe169b3 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 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
> 1f08893..c480689 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 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)); @@ -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 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
> 02ddbbd..ba760fe 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