[Mesa-dev] [PATCH 5/9] glsl: allow multiple layout-qualifier in single declaration if enhanced layouts
Andres Gomez
agomez at igalia.com
Sat Oct 22 20:09:12 UTC 2016
>From the ARB_enhanced_layouts spec:
"Additions to Chapter 4 "Variables and Types" of the OpenGL Shading Language
Section 4.4 "Layout Qualifiers"
The existing last paragraph already says:
"More than one layout qualifier may appear in a single declaration. If
the same layout-qualifier-name occurs in multiple layout qualifiers
for the same declaration, the last one overrides the former ones."
Expand it to say:
"More than one layout qualifier may appear in a single declaration.
Additionally, the same layout-qualifier-name can occur multiple times
within a layout qualifier or across multiple layout qualifiers in the
same declaration. When the same layout-qualifier-name occurs
multiple times, in a single declaration, the last occurrence overrides
the former occurrence(s). Further, if such a layout-qualifier-name
will effect subsequent declarations or other observable behavior, it
is only the last occurrence that will have any effect, behaving as if
the earlier occurrence(s) within the declaration are not present.
This is also true for overriding layout-qualifier-names, where one
overrides the other (e.g., row_major vs. column_major); only the last
occurrence has any effect.""
Signed-off-by: Andres Gomez <agomez at igalia.com>
---
src/compiler/glsl/ast_type.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index 48ee27e..02f96ea 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -201,7 +201,8 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
return false;
}
- if (is_multiple_layouts_merge && !state->has_420pack_or_es31()) {
+ if (is_multiple_layouts_merge
+ && !state->has_420pack_or_es31() && !state->has_enhanced_layouts()) {
_mesa_glsl_error(loc, state,
"duplicate layout(...) qualifiers");
return false;
--
2.9.3
More information about the mesa-dev
mailing list