Module: Mesa
Branch: staging/20.3
Commit: 7ca951d11ade592f125d4030ffc020a0c1640931
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ca951d11ade592f125d4030ffc020a0c1640931

Author: Timothy Arceri <[email protected]>
Date:   Sat Oct  3 13:24:30 2020 +1000

glsl: default to compat shaders in compat profile

If the shader does not specify "core" or "compatibility" in shaders
above 1.40 we were defaulting these shaders to core shaders when
in a compat profile. Instead default to compat shaders.

This brings us inline with the behaviour of the binary drivers and
fixes a crash on start-up for the game Foundation.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3594

Fixes: c7e3d31b0b5f ("glsl: fix compat shaders in GLSL 1.40")

Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Zoltán Böszörményi <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6993>
(cherry picked from commit 6c8cc9be12dc5d6c0d2386d6addb69d8f2fb5399)

---

 .pick_status.json                        | 2 +-
 src/compiler/glsl/glsl_parser_extras.cpp | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 2cb82f53e78..d2398618e1c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "glsl: default to compat shaders in compat profile",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "c7e3d31b0b5f22299a6bd72655502ce8427b40bf"
     },
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index 7daf65bef6d..6c735eaea04 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -396,14 +396,13 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE 
*locp, int version,
 {
    bool es_token_present = false;
    bool compat_token_present = false;
+   bool core_token_present = false;
    if (ident) {
       if (strcmp(ident, "es") == 0) {
          es_token_present = true;
       } else if (version >= 150) {
          if (strcmp(ident, "core") == 0) {
-            /* Accept the token.  There's no need to record that this is
-             * a core profile shader since that's the only profile we support.
-             */
+            core_token_present = true;
          } else if (strcmp(ident, "compatibility") == 0) {
             compat_token_present = true;
 
@@ -444,7 +443,8 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE 
*locp, int version,
 
    this->compat_shader = compat_token_present ||
                          (this->ctx->API == API_OPENGL_COMPAT &&
-                          this->language_version == 140) ||
+                          this->language_version >= 140 &&
+                          !core_token_present) ||
                          (!this->es_shader && this->language_version < 140);
 
    bool supported = false;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to