[Mesa-dev] [PATCH] glsl/es3.1: Fix up GL_ARB_compute_shader for GLSL ES 3.1

Ilia Mirkin imirkin at alum.mit.edu
Tue Jun 23 14:11:34 PDT 2015


On Tue, Jun 23, 2015 at 7:20 AM, Marta Lofstedt
<marta.lofstedt at linux.intel.com> wrote:
> From: Marta Lofstedt <marta.lofstedt at intel.com>
>
> GL_ARB_compute_shader is limited for GLSL version 430.
> This enables for GLSL ES version 310.
>
> Signed-off-by: Marta Lofstedt <marta.lofstedt at linux.intel.com>
> ---
>  src/glsl/builtin_variables.cpp | 2 +-
>  src/glsl/glsl_parser.yy        | 3 +--
>  src/glsl/glsl_parser_extras.h  | 5 +++++
>  3 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> index a765d35..2681981 100644
> --- a/src/glsl/builtin_variables.cpp
> +++ b/src/glsl/builtin_variables.cpp
> @@ -695,7 +695,7 @@ builtin_variable_generator::generate_constants()
>        }
>     }
>
> -   if (state->is_version(430, 0) || state->ARB_compute_shader_enable) {
> +   if (state->has_compute_shader()) {
>        add_const("gl_MaxComputeAtomicCounterBuffers", MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS);
>        add_const("gl_MaxComputeAtomicCounters", MAX_COMPUTE_ATOMIC_COUNTERS);
>        add_const("gl_MaxComputeImageUniforms", MAX_COMPUTE_IMAGE_UNIFORMS);
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 3ce9e10..757e548 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1483,8 +1483,7 @@ layout_qualifier_id:
>                                  "invalid %s of %d specified",
>                                  local_size_qualifiers[i], $3);
>                 YYERROR;
> -            } else if (!state->is_version(430, 0) &&
> -                       !state->ARB_compute_shader_enable) {
> +            } else if (!state->has_compute_shader()) {
>                 _mesa_glsl_error(& @3, state,
>                                  "%s qualifier requires GLSL 4.30 or "
>                                  "ARB_compute_shader",

Should this string mention GLSL ES 3.10 as well? Not sure what's done elsewhere.

> diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
> index a231d96..74838d3 100644
> --- a/src/glsl/glsl_parser_extras.h
> +++ b/src/glsl/glsl_parser_extras.h
> @@ -231,6 +231,11 @@ struct _mesa_glsl_parse_state {
>        return ARB_gpu_shader_fp64_enable || is_version(400, 0);
>     }
>
> +   bool has_compute_shader() const
> +   {
> +      return ARB_compute_shader_enable || is_version(430, 310);
> +   }
> +
>     void process_version_directive(YYLTYPE *locp, int version,
>                                    const char *ident);
>
> --
> 1.9.1
>
> _______________________________________________
> 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