It is illegal to redeclare builtin variables with incompatible layout qualifiers in seprerate shader objects that are linked together. Since a redeclaration without any layout qualifiers can be incompatible with another redeclartion where no redeclaration wouldn't be, it can be necessary to know wether a variable was redeclared. --- src/glsl/ast_to_hir.cpp | 1 + src/glsl/ir.cpp | 1 + src/glsl/ir.h | 7 +++++++ src/glsl/ir_clone.cpp | 1 + 4 files changed, 10 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9ef73b5..63fbd5a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2271,6 +2271,7 @@ get_variable_being_redeclared(ir_variable *var, ast_declaration *decl, _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier); } + earlier->redeclared = true; return earlier; } diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 2c54525..c535c5e 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1536,6 +1536,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, this->pixel_center_integer = false; this->depth_layout = ir_depth_layout_none; this->used = false; + this->redeclared = false; if (type && type->base_type == GLSL_TYPE_SAMPLER) this->read_only = true; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 6783eca..fae0c30 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -415,6 +415,13 @@ public: unsigned invariant:1; /** + * Was this variable redeclared? + * + * This is only maintained in the ast_to_hir.cpp path. + */ + unsigned redeclared:1; + + /** * Has this variable been used for reading or writing? * * Several GLSL semantic checks require knowledge of whether or not a diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 5b42935..2abf62f 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -47,6 +47,7 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const var->read_only = this->read_only; var->centroid = this->centroid; var->invariant = this->invariant; + var->redeclared = this->redeclared; var->interpolation = this->interpolation; var->location = this->location; var->index = this->index; -- 1.8.1.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev