summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir_clone.cpp3
-rw-r--r--src/glsl/ir_hv_accept.cpp6
-rw-r--r--src/glsl/loop_controls.cpp2
3 files changed, 9 insertions, 2 deletions
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 40ed33afcee..8f57499ec97 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -163,7 +163,8 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
new_loop->to = this->to->clone(mem_ctx, ht);
if (this->increment)
new_loop->increment = this->increment->clone(mem_ctx, ht);
- new_loop->counter = counter;
+ if (this->counter)
+ new_loop->counter = this->counter->clone(mem_ctx, ht);
foreach_iter(exec_list_iterator, iter, this->body_instructions) {
ir_instruction *ir = (ir_instruction *)iter.get();
diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp
index 941b25e97c4..a0fe3b95d35 100644
--- a/src/glsl/ir_hv_accept.cpp
+++ b/src/glsl/ir_hv_accept.cpp
@@ -87,6 +87,12 @@ ir_loop::accept(ir_hierarchical_visitor *v)
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
+ if (this->counter) {
+ s = this->counter->accept(v);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+ }
+
s = visit_list_elements(v, &this->body_instructions);
if (s == visit_stop)
return s;
diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp
index 26481930db7..0eb103f49b8 100644
--- a/src/glsl/loop_controls.cpp
+++ b/src/glsl/loop_controls.cpp
@@ -254,7 +254,7 @@ loop_control_visitor::visit_leave(ir_loop *ir)
ir->from = init->clone(ir, NULL);
ir->to = limit->clone(ir, NULL);
ir->increment = lv->increment->clone(ir, NULL);
- ir->counter = lv->var;
+ ir->counter = lv->var->clone(ir, NULL);
ir->cmp = cmp;
max_iterations = iterations;