compiler/glsl: do not cast struct to string

When formatting the error here, we're currently casting an
ast_type_qualifier as a string.

But we don't need to use a string here at all, because we know from
context exactly what qualifier we're talking about, because the
if-statements explicitly check for the uniform-qualifier.

So let's just hard-code the format-string to reference the right
qualifier instead of the string-shenanigans. The latter cannot do the
right thing.

Fixes: 2d03f48a65 ("glsl: Add parsing for GLSL uniform blocks.")
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9911>
(cherry picked from commit 437ed05708)
This commit is contained in:
Erik Faye-Lund 2021-03-29 12:45:41 +02:00 committed by Dylan Baker
parent 4d4e4a3e60
commit 127f04f288
2 changed files with 3 additions and 3 deletions

View file

@ -499,7 +499,7 @@
"description": "compiler/glsl: do not cast struct to string",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "2d03f48a65a666ecdcfaffa3d39ad1b77f2b25b6"
},

View file

@ -1894,11 +1894,11 @@ layout_qualifier_id:
if ($$.flags.q.uniform && !state->has_uniform_buffer_objects()) {
_mesa_glsl_error(& @1, state,
"#version 140 / GL_ARB_uniform_buffer_object "
"layout qualifier `%s' is used", $1);
"layout qualifier `uniform' is used");
} else if ($$.flags.q.uniform && state->ARB_uniform_buffer_object_warn) {
_mesa_glsl_warning(& @1, state,
"#version 140 / GL_ARB_uniform_buffer_object "
"layout qualifier `%s' is used", $1);
"layout qualifier `uniform' is used");
}
}
;