From: Iago Toral Quiroga <ito...@igalia.com> We were doing this for all variables in a declaration list, but not when there was just a single declaration. As a consequence, when we used a single variable declaration to redeclare a type that existed in a previous scope we would get a parsing error, so this would work:
struct S { int val; }; void main() { int Z, S; S = 1; } but this wouldn't: struct S { int val; }; void main() { int S; S = 1; } Fixes the following 4 dEQP tests: dEQP-GLES3.functional.shaders.scoping.valid.local_int_variable_hides_struct_type_vertex dEQP-GLES3.functional.shaders.scoping.valid.local_int_variable_hides_struct_type_fragment dEQP-GLES3.functional.shaders.scoping.valid.local_struct_variable_hides_struct_type_vertex dEQP-GLES3.functional.shaders.scoping.valid.local_struct_variable_hides_struct_type_fragment --- src/glsl/glsl_parser.yy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 7fb8c38..17422ed 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1070,6 +1070,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @2); $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | fully_specified_type any_identifier array_specifier { @@ -1080,6 +1081,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @3); $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | fully_specified_type any_identifier array_specifier '=' initializer { @@ -1090,6 +1092,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @3); $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | fully_specified_type any_identifier '=' initializer { @@ -1100,6 +1103,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @2); $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | INVARIANT variable_identifier { @@ -1112,6 +1116,7 @@ single_declaration: $$->invariant = true; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | PRECISE variable_identifier { @@ -1124,6 +1129,7 @@ single_declaration: $$->precise = true; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } ; -- 2.1.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev