diff options
author | Kenneth Graunke <[email protected]> | 2010-08-21 20:23:18 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-08-26 09:19:48 -0700 |
commit | e9c7ceed27f6811ad1cae46c93ce9bc3fb3668d8 (patch) | |
tree | e66302bca944353decf9b78291effb9cee7a4982 /src/glsl/ast_to_hir.cpp | |
parent | 86ddb356e8278423ef41125be627e57e073471d1 (diff) |
glsl: Use a single shared namespace in the symbol table.
As of 1.20, variable names, function names, and structure type names all
share a single namespace, and should conflict with one another in the
same scope, or hide each other in nested scopes.
However, in 1.10, variables and functions can share the same name in the
same scope. Structure types, however, conflict with/hide both.
Fixes piglit tests redeclaration-06.vert, redeclaration-11.vert,
redeclaration-19.vert, and struct-05.vert.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 2fec02668d8..8c105e79f71 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2630,18 +2630,10 @@ ast_struct_specifier::hir(exec_list *instructions, glsl_type::get_record_instance(fields, decl_count, name); YYLTYPE loc = this->get_location(); - if (!state->symbols->add_type(name, t)) { + ir_function *ctor = t->generate_constructor(); + if (!state->symbols->add_type(name, t, ctor)) { _mesa_glsl_error(& loc, state, "struct `%s' previously defined", name); } else { - /* This logic is a bit tricky. It is an error to declare a structure at - * global scope if there is also a function with the same name. - */ - if ((state->current_function == NULL) - && (state->symbols->get_function(name) != NULL)) { - _mesa_glsl_error(& loc, state, "name `%s' previously defined", name); - } else { - t->generate_constructor(state->symbols); - } const glsl_type **s = (const glsl_type **) realloc(state->user_structures, |