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: f9f462936a ("glsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14241>
This commit is contained in:
Tapani Pälli 2021-12-16 19:01:34 +02:00 committed by Marge Bot
parent 0bc5e8cddc
commit ebd1f202ae
2 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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",