summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/ast_to_hir.cpp4
-rw-r--r--src/glsl/glsl_parser_extras.cpp8
-rw-r--r--src/glsl/glsl_symbol_table.cpp2
-rw-r--r--src/glsl/linker.cpp4
-rw-r--r--src/glsl/lower_packed_varyings.cpp1
5 files changed, 14 insertions, 5 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 5ec1614be34..068af295aa1 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -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);
}
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 2da6d5ab9d5..5005cff9d67 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -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;
}
diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp
index a052362035b..2294dda42c8 100644
--- a/src/glsl/glsl_symbol_table.cpp
+++ b/src/glsl/glsl_symbol_table.cpp
@@ -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);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index dbcc5b4578f..47a722d9d1e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -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;
}
}
diff --git a/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp
index 78014831566..5e844c792e8 100644
--- a/src/glsl/lower_packed_varyings.cpp
+++ b/src/glsl/lower_packed_varyings.cpp
@@ -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. */