[Mesa-dev] [RFC] glsl: bump default glsl version to 130 if EXT_gpu_shader4 used

Ilia Mirkin imirkin at alum.mit.edu
Tue May 15 19:36:27 UTC 2018


The extension is totally different... it adds things like "unsigned
int", and a ton of texture*/shadow* variants. If it helps this one
shader compile, that's a coincidence. IMO it's dangerous to start
throwing things like this in.

  -ilia

On Mon, May 14, 2018 at 10:32 PM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> EXT_gpu_shader4 is GL 3.0 plus some more bits and pieces. Currently
> the extension is never enabled for any drivers. Bumping the glsl
> version should allow shaders to compile.
>
> Noticed when looking at the trace from:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102522
> ---
>  src/compiler/glsl/glsl_parser_extras.cpp | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index c6ffdcc588c..9d22b53de56 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -422,7 +422,7 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
>
>     if (this->forced_language_version)
>        this->language_version = this->forced_language_version;
> -   else
> +   else if ((unsigned)version > this->language_version)
>        this->language_version = version;
>
>     this->compat_shader = compat_token_present ||
> @@ -814,6 +814,23 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
>        }
>     } else {
>        const _mesa_glsl_extension *extension = find_extension(name);
> +
> +      /* The following is a hack while EXT_gpu_shader4 is unsupported.
> +       */
> +      assert(state->ctx->Extensions.EXT_gpu_shader4 == false);
> +      if (state->language_version < 130 &&
> +          state->ctx->Const.GLSLVersion >= 130 &&
> +          strcmp(name, "GL_EXT_gpu_shader4") == 0 &&
> +          (behavior == extension_enable || behavior == extension_require)) {
> +
> +         state->language_version = 130;
> +         _mesa_glsl_warning(name_locp, state,
> +                            "extension `%s' unsupported in %s shader."
> +                            " Use GLSL 1.30 instead.",
> +                            name, _mesa_shader_stage_to_string(state->stage));
> +         return true;
> +      }
> +
>        if (extension && extension->compatible_with_state(state, api, gl_version)) {
>           extension->set_flags(state, behavior);
>           if (extension->available_pred == has_ANDROID_extension_pack_es31a) {
> --
> 2.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list