glsl: Use has_layout() rather than a partial open coded version.
The idea of this code is to disallow layout(...) sections with the deprecated "varying" or "attribute" keywords, unless a few select extensions are enabled which allow a more relaxed check. In order to detect a layout(...) section, the code checks for a number of layout qualifiers. However, it failed to check for all of them, which could lead to layout(...) not being detected when it should. By replacing this with has_layout(), we properly check for all layout qualifiers, and also guarantees that new qualifiers added in the future will not be forgotten. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
parent
c397ec94e9
commit
56bcde34b2
|
@ -2080,12 +2080,6 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
|
||||||
"explicit index requires explicit location\n");
|
"explicit index requires explicit location\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does the declaration use the 'layout' keyword?
|
|
||||||
*/
|
|
||||||
const bool uses_layout = qual->flags.q.pixel_center_integer
|
|
||||||
|| qual->flags.q.origin_upper_left
|
|
||||||
|| qual->flags.q.explicit_location; /* no need for index since it relies on location */
|
|
||||||
|
|
||||||
/* Does the declaration use the deprecated 'attribute' or 'varying'
|
/* Does the declaration use the deprecated 'attribute' or 'varying'
|
||||||
* keywords?
|
* keywords?
|
||||||
*/
|
*/
|
||||||
|
@ -2115,7 +2109,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
|
||||||
const bool relaxed_layout_qualifier_checking =
|
const bool relaxed_layout_qualifier_checking =
|
||||||
state->ARB_fragment_coord_conventions_enable;
|
state->ARB_fragment_coord_conventions_enable;
|
||||||
|
|
||||||
if (uses_layout && uses_deprecated_qualifier) {
|
if (qual->has_layout() && uses_deprecated_qualifier) {
|
||||||
if (relaxed_layout_qualifier_checking) {
|
if (relaxed_layout_qualifier_checking) {
|
||||||
_mesa_glsl_warning(loc, state,
|
_mesa_glsl_warning(loc, state,
|
||||||
"`layout' qualifier may not be used with "
|
"`layout' qualifier may not be used with "
|
||||||
|
|
Loading…
Reference in New Issue