Mesa (main): glsl: fix invariant qualifer usage and matching rule for GLSL 4.20

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 22 06:28:22 UTC 2021


Module: Mesa
Branch: main
Commit: ebd1f202ae10f851b23392c022e059467b90475d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebd1f202ae10f851b23392c022e059467b90475d

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Thu Dec 16 19:01:34 2021 +0200

glsl: fix invariant qualifer usage and matching rule for GLSL 4.20

I noticed that GLSL version referenced here was wrong, version 4.20 is
first spec that does not allow invariant keyword for inputs.

v2: fix all comments (Timothy Arceri)

Fixes: f9f462936ad ("glsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.")
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14241>

---

 src/compiler/glsl/glsl_parser.yy    | 4 ++--
 src/compiler/glsl/link_varyings.cpp | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 4111c45c97d..29b6dc2f72e 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2047,9 +2047,9 @@ type_qualifier:
        * output from one shader stage will still match an input of a subsequent
        * stage without the input being declared as invariant."
        *
-       * On the desktop side, this text first appears in GLSL 4.30.
+       * On the desktop side, this text first appears in GLSL 4.20.
        */
-      if (state->is_version(430, 300) && $$.flags.q.in)
+      if (state->is_version(420, 300) && $$.flags.q.in)
          _mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with shader inputs");
    }
    | interpolation_qualifier type_qualifier
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 4f8e5566d1c..d5357ab34d4 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -319,13 +319,13 @@ cross_validate_types_and_qualifiers(struct gl_context *ctx,
       return;
    }
 
-   /* The GLSL 4.30 and GLSL ES 3.00 specifications say:
+   /* The GLSL 4.20 and GLSL ES 3.00 specifications say:
     *
     *    "As only outputs need be declared with invariant, an output from
     *     one shader stage will still match an input of a subsequent stage
     *     without the input being declared as invariant."
     *
-    * while GLSL 4.20 says:
+    * while GLSL 4.10 says:
     *
     *    "For variables leaving one shader and coming into another shader,
     *     the invariant keyword has to be used in both shaders, or a link
@@ -337,7 +337,7 @@ cross_validate_types_and_qualifiers(struct gl_context *ctx,
     *     and fragment shaders must match."
     */
    if (input->data.explicit_invariant != output->data.explicit_invariant &&
-       prog->data->Version < (prog->IsES ? 300 : 430)) {
+       prog->data->Version < (prog->IsES ? 300 : 420)) {
       linker_error(prog,
                    "%s shader output `%s' %s invariant qualifier, "
                    "but %s shader input %s invariant qualifier\n",



More information about the mesa-commit mailing list