[Mesa-dev] [PATCH] glsl: allow duplicate layout-qualifier-names
Timothy Arceri
timothy.arceri at collabora.com
Wed Jan 13 21:26:22 PST 2016
The special case from detecting stream duplicates is also
removed, as testing never trigged this error.
>From the ARB_shading_language_420pack spec:
"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."
While the extension spec is taking about multiple layout
qualifiers we interpret that to mean layout-qualifier-names
can also occur multiple times within a single layout qualifier.
In Section 4.4 (Layout Qualifiers) of the GLSL 4.40 spec it
clarifies this:
"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"
---
The Nvidia driver allows this for GLSL 4.20 but not for the
extension.
Piglit tests:
http://patchwork.freedesktop.org/patch/70459/
src/glsl/ast_type.cpp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index f4e51b8..afae687 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -158,7 +158,8 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
allowed_duplicates_mask.flags.i |=
stream_layout_mask.flags.i;
- if ((this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
+ if (!state->has_420pack() &&
+ (this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
_mesa_glsl_error(loc, state,
"duplicate layout qualifiers used");
return false;
@@ -209,11 +210,6 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
this->flags.q.stream = 1;
this->stream = state->out_qualifier->stream;
}
- } else {
- if (q.flags.q.explicit_stream) {
- _mesa_glsl_error(loc, state,
- "duplicate layout `stream' qualifier");
- }
}
}
--
2.4.3
More information about the mesa-dev
mailing list