[Mesa-dev] [PATCH v5 22/70] glsl: ignore default qualifier declarations when checking for duplicate layout qualifiers
Iago Toral Quiroga
itoral at igalia.com
Thu Sep 10 06:35:38 PDT 2015
From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
src/glsl/ast.h | 3 +++
src/glsl/glsl_parser.yy | 5 ++++-
src/glsl/glsl_parser_extras.cpp | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index d8c6cea..335f426 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -639,6 +639,9 @@ struct ast_type_qualifier {
*/
glsl_base_type image_base_type;
+ /** Flag to know if this represents a default value for a qualifier */
+ bool is_default_qualifier;
+
/**
* Return true if and only if an interpolation qualifier is present.
*/
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 4dd5384..42108a3 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -2599,7 +2599,8 @@ interface_block:
{
ast_interface_block *block = (ast_interface_block *) $2;
- if (!state->has_420pack() && block->layout.has_layout()) {
+ if (!state->has_420pack() && block->layout.has_layout() &&
+ !block->layout.is_default_qualifier) {
_mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
YYERROR;
}
@@ -2608,6 +2609,8 @@ interface_block:
YYERROR;
}
+ block->layout.is_default_qualifier = false;
+
foreach_list_typed (ast_declarator_list, member, link, &block->declarations) {
ast_type_qualifier& qualifier = member->type->qualifier;
if (qualifier.flags.q.stream && qualifier.stream != block->layout.stream) {
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 939a03c..20bbe6e 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -242,6 +242,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->default_uniform_qualifier = new(this) ast_type_qualifier();
this->default_uniform_qualifier->flags.q.shared = 1;
this->default_uniform_qualifier->flags.q.column_major = 1;
+ this->default_uniform_qualifier->is_default_qualifier = true;
this->fs_uses_gl_fragcoord = false;
this->fs_redeclares_gl_fragcoord = false;
--
1.9.1
More information about the mesa-dev
mailing list