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

Timothy Arceri tarceri at itsqueeze.com
Tue May 15 02:32:31 UTC 2018


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



More information about the mesa-dev mailing list