diff options
author | Eric Anholt <eric@anholt.net> | 2010-11-05 06:11:24 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-11-29 17:08:27 -0800 |
commit | 001eee52d461233b1e1d6ed3577965e9bcb209e8 (patch) | |
tree | 78233cab5abd5687c625f2bde89f3332974022da /src/glsl | |
parent | e8f5ebf313da3ce33ccbbcf9b72946853035fbdd (diff) |
glsl: Make the symbol table's add_variable just use the variable's name.
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 4 | ||||
-rw-r--r-- | src/glsl/glsl_symbol_table.cpp | 10 | ||||
-rw-r--r-- | src/glsl/glsl_symbol_table.h | 2 | ||||
-rw-r--r-- | src/glsl/ir_reader.cpp | 2 | ||||
-rw-r--r-- | src/glsl/ir_variable.cpp | 2 | ||||
-rw-r--r-- | src/glsl/link_functions.cpp | 2 | ||||
-rw-r--r-- | src/glsl/linker.cpp | 8 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 1f00127319..fd9ed55680 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2253,7 +2253,7 @@ ast_declarator_list::hir(exec_list *instructions, * after the initializer if present or immediately after the name * being declared if not." */ - if (!state->symbols->add_variable(var->name, var)) { + if (!state->symbols->add_variable(var)) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(&loc, state, "name `%s' already taken in the " "current scope", decl->identifier); @@ -2587,7 +2587,7 @@ ast_function_definition::hir(exec_list *instructions, _mesa_glsl_error(& loc, state, "parameter `%s' redeclared", var->name); } else { - state->symbols->add_variable(var->name, var); + state->symbols->add_variable(var); } } diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index 3b384d875a..fb22a17ce5 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -81,12 +81,12 @@ bool glsl_symbol_table::name_declared_this_scope(const char *name) return _mesa_symbol_table_symbol_scope(table, -1, name) == 0; } -bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) +bool glsl_symbol_table::add_variable(ir_variable *v) { if (this->language_version == 110) { /* In 1.10, functions and variables have separate namespaces. */ - symbol_table_entry *existing = get_entry(name); - if (name_declared_this_scope(name)) { + symbol_table_entry *existing = get_entry(v->name); + if (name_declared_this_scope(v->name)) { /* If there's already an existing function (not a constructor!) in * the current scope, just update the existing entry to include 'v'. */ @@ -102,7 +102,7 @@ bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); if (existing != NULL) entry->f = existing->f; - int added = _mesa_symbol_table_add_symbol(table, -1, name, entry); + int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry); assert(added == 0); (void)added; return true; @@ -112,7 +112,7 @@ bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) /* 1.20+ rules: */ symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); - return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; + return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0; } bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 883c301e32..329cd106b1 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -97,7 +97,7 @@ public: * reduces the clarity of the intention of code that uses these methods. */ /*@{*/ - bool add_variable(const char *name, ir_variable *v); + bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); bool add_function(ir_function *f); /*@}*/ diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 446776c691..5a718d3b75 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -474,7 +474,7 @@ read_declaration(_mesa_glsl_parse_state *st, s_list *list) } // Add the variable to the symbol table - st->symbols->add_variable(var->name, var); + st->symbols->add_variable(var); return var; } diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 6b9b29458d..5b8281e16e 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -59,7 +59,7 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot, */ instructions->push_tail(var); - symtab->add_variable(var->name, var); + symtab->add_variable(var); return var; } diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 78c8b48cf1..05930edb80 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -183,7 +183,7 @@ public: * it to the linked shader. */ var = ir->var->clone(linked, NULL); - linked->symbols->add_variable(var->name, var); + linked->symbols->add_variable(var); linked->ir->push_head(var); } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 7aa94064d6..8d14c5afdf 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -412,7 +412,7 @@ cross_validate_globals(struct gl_shader_program *prog, var->constant_value->clone(talloc_parent(existing), NULL); } } else - variables.add_variable(var->name, var); + variables.add_variable(var); } } @@ -454,7 +454,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog, if ((var == NULL) || (var->mode != ir_var_out)) continue; - parameters.add_variable(var->name, var); + parameters.add_variable(var); } @@ -548,7 +548,7 @@ populate_symbol_table(gl_shader *sh) if ((func = inst->as_function()) != NULL) { sh->symbols->add_function(func); } else if ((var = inst->as_variable()) != NULL) { - sh->symbols->add_variable(var->name, var); + sh->symbols->add_variable(var); } } } @@ -605,7 +605,7 @@ remap_variables(ir_instruction *inst, struct gl_shader *target, else { ir_variable *copy = ir->var->clone(this->target, NULL); - this->symbols->add_variable(copy->name, copy); + this->symbols->add_variable(copy); this->instructions->push_head(copy); ir->var = copy; } |