glsl: Never put ir_var_temporary variables in the symbol table
Later patches will give every ir_var_temporary the same name in release builds. Adding a bunch of variables named "compiler_temp" to the symbol table can only cause problems. No change Valgrind massif results for a trimmed apitrace of dota2. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -912,7 +912,6 @@ get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue)
|
||||
var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp",
|
||||
ir_var_temporary);
|
||||
instructions->push_tail(var);
|
||||
var->data.mode = ir_var_auto;
|
||||
|
||||
instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var),
|
||||
lvalue));
|
||||
@@ -2499,6 +2498,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
|
||||
/* If there is no qualifier that changes the mode of the variable, leave
|
||||
* the setting alone.
|
||||
*/
|
||||
assert(var->data.mode != ir_var_temporary);
|
||||
if (qual->flags.q.in && qual->flags.q.out)
|
||||
var->data.mode = ir_var_function_inout;
|
||||
else if (qual->flags.q.in)
|
||||
@@ -5031,7 +5031,7 @@ ast_type_specifier::hir(exec_list *instructions,
|
||||
*/
|
||||
ir_variable *const junk =
|
||||
new(state) ir_variable(type, "#default precision",
|
||||
ir_var_temporary);
|
||||
ir_var_auto);
|
||||
|
||||
state->symbols->add_variable(junk);
|
||||
}
|
||||
|
||||
@@ -1536,9 +1536,13 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
||||
case ir_type_function:
|
||||
shader->symbols->add_function((ir_function *) ir);
|
||||
break;
|
||||
case ir_type_variable:
|
||||
shader->symbols->add_variable((ir_variable *) ir);
|
||||
case ir_type_variable: {
|
||||
ir_variable *const var = (ir_variable *) ir;
|
||||
|
||||
if (var->data.mode != ir_var_temporary)
|
||||
shader->symbols->add_variable(var);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,8 @@ bool glsl_symbol_table::name_declared_this_scope(const char *name)
|
||||
|
||||
bool glsl_symbol_table::add_variable(ir_variable *v)
|
||||
{
|
||||
assert(v->data.mode != ir_var_temporary);
|
||||
|
||||
if (this->separate_function_namespace) {
|
||||
/* In 1.10, functions and variables have separate namespaces. */
|
||||
symbol_table_entry *existing = get_entry(v->name);
|
||||
|
||||
+3
-1
@@ -976,7 +976,8 @@ 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);
|
||||
if (var->data.mode != ir_var_temporary)
|
||||
sh->symbols->add_variable(var);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2185,6 +2186,7 @@ demote_shader_inputs_and_outputs(gl_shader *sh, enum ir_variable_mode mode)
|
||||
* to have a location assigned.
|
||||
*/
|
||||
if (var->data.is_unmatched_generic_inout) {
|
||||
assert(var->data.mode != ir_var_temporary);
|
||||
var->data.mode = ir_var_auto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,6 +261,7 @@ lower_packed_varyings_visitor::run(exec_list *instructions)
|
||||
!var->type->contains_integer());
|
||||
|
||||
/* Change the old varying into an ordinary global. */
|
||||
assert(var->data.mode != ir_var_temporary);
|
||||
var->data.mode = ir_var_auto;
|
||||
|
||||
/* Create a reference to the old varying. */
|
||||
|
||||
Reference in New Issue
Block a user