summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_dead_code.cpp12
-rw-r--r--src/glsl/ir_optimization.h6
-rw-r--r--src/glsl/main.cpp2
3 files changed, 9 insertions, 11 deletions
diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp
index ea78107f49..4804407bdc 100644
--- a/src/glsl/ir_dead_code.cpp
+++ b/src/glsl/ir_dead_code.cpp
@@ -146,13 +146,12 @@ ir_dead_code_visitor::visit_leave(ir_assignment *ir)
* for usage on an unlinked instruction stream.
*/
bool
-do_dead_code(struct _mesa_glsl_parse_state *state,
- exec_list *instructions)
+do_dead_code(exec_list *instructions)
{
ir_dead_code_visitor v;
bool progress = false;
- v.mem_ctx = state;
+ v.mem_ctx = talloc_new(NULL);
v.run(instructions);
foreach_iter(exec_list_iterator, iter, v.variable_list) {
@@ -188,6 +187,8 @@ do_dead_code(struct _mesa_glsl_parse_state *state,
progress = true;
}
}
+ talloc_free(v.mem_ctx);
+
return progress;
}
@@ -199,8 +200,7 @@ do_dead_code(struct _mesa_glsl_parse_state *state,
* with global scope.
*/
bool
-do_dead_code_unlinked(struct _mesa_glsl_parse_state *state,
- exec_list *instructions)
+do_dead_code_unlinked(exec_list *instructions)
{
bool progress = false;
@@ -211,7 +211,7 @@ do_dead_code_unlinked(struct _mesa_glsl_parse_state *state,
foreach_iter(exec_list_iterator, sigiter, *f) {
ir_function_signature *sig =
(ir_function_signature *) sigiter.get();
- if (do_dead_code(state, &sig->body))
+ if (do_dead_code(&sig->body))
progress = true;
}
}
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 4f39565e5f..5dbb025d35 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -33,11 +33,9 @@ bool do_constant_folding(exec_list *instructions);
bool do_constant_variable(exec_list *instructions);
bool do_constant_variable_unlinked(exec_list *instructions);
bool do_copy_propagation(exec_list *instructions);
-bool do_dead_code(struct _mesa_glsl_parse_state *state,
- exec_list *instructions);
+bool do_dead_code(exec_list *instructions);
bool do_dead_code_local(exec_list *instructions);
-bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state,
- exec_list *instructions);
+bool do_dead_code_unlinked(exec_list *instructions);
bool do_div_to_mul_rcp(exec_list *instructions);
bool do_function_inlining(exec_list *instructions);
bool do_if_return(exec_list *instructions);
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index b62902278c..08b133f124 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -162,7 +162,7 @@ compile_shader(struct gl_shader *shader)
progress = do_if_simplification(shader->ir) || progress;
progress = do_copy_propagation(shader->ir) || progress;
progress = do_dead_code_local(shader->ir) || progress;
- progress = do_dead_code_unlinked(state, shader->ir) || progress;
+ progress = do_dead_code_unlinked(shader->ir) || progress;
progress = do_constant_variable_unlinked(shader->ir) || progress;
progress = do_constant_folding(shader->ir) || progress;
progress = do_algebraic(shader->ir) || progress;