diff options
author | Fabian Bieler <der.fabe@gmx.net> | 2010-12-01 14:44:58 +0100 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-12-27 13:11:26 -0800 |
commit | 9d1c6dd79b2f6f16f650b72b96a2e53fac39d4d5 (patch) | |
tree | 6626456d931bd56d08076797c9f06d442b62c839 | |
parent | 47552b2c66703ce8351312ac051bc51bce283935 (diff) |
glsl: fix lowering conditional returns in subroutines
this fix applies to the lower_sub_return 'branch' of the lower_jumps pass
Fixes piglit tests glsl-functions-5 and glsl-functions-6.
(cherry picked from commit ef534f3838f23d757a40426728789183ed36c3bb)
-rw-r--r-- | src/glsl/ir_lower_jumps.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/glsl/ir_lower_jumps.cpp b/src/glsl/ir_lower_jumps.cpp index a86417c657..965909d839 100644 --- a/src/glsl/ir_lower_jumps.cpp +++ b/src/glsl/ir_lower_jumps.cpp @@ -481,7 +481,11 @@ lower_continue: if(this->loop.may_set_return_flag) { assert(this->function.return_flag); ir_if* return_if = new(ir) ir_if(new(ir) ir_dereference_variable(this->function.return_flag)); - return_if->then_instructions.push_tail(new(ir) ir_loop_jump(saved_loop.loop ? ir_loop_jump::jump_break : ir_loop_jump::jump_continue)); + saved_loop.may_set_return_flag = true; + if(saved_loop.loop) + return_if->then_instructions.push_tail(new(ir) ir_loop_jump(ir_loop_jump::jump_break)); + else + move_outer_block_inside(ir, &return_if->else_instructions); ir->insert_after(return_if); } |