From 7c59c3090570fd56b0ba99a0452ae90b4991c023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Thu, 16 Dec 2021 19:01:34 +0200 Subject: [PATCH] glsl: fix invariant qualifer usage and matching rule for GLSL 4.20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák Reviewed-by: Timothy Arceri Part-of: (cherry picked from commit ebd1f202ae10f851b23392c022e059467b90475d) --- .pick_status.json | 2 +- src/compiler/glsl/glsl_parser.yy | 4 ++-- src/compiler/glsl/link_varyings.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2128319881a..2057e72d77d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -850,7 +850,7 @@ "description": "glsl: fix invariant qualifer usage and matching rule for GLSL 4.20", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f9f462936ad903f93829404ce99a2580ea21b725" }, 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 abae4377e83..4244c2d4e0a 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",