diff options
author | Timothy Arceri <[email protected]> | 2017-04-07 11:24:37 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-04-08 11:18:32 +1000 |
commit | bfabef0e7104dc4043a74ef44e71ecc7636cfe12 (patch) | |
tree | 80c1095eb57129ac87b098c87366654664fe1fe0 /src/compiler/glsl/lower_jumps.cpp | |
parent | 5dd490f134cff8a0b6da1417d146e92df1860b0f (diff) |
glsl: fix lower jumps for nested non-void returns
Fixes the case were a loop contains a return and the loop is
nested inside an if.
Reviewed-by: Roland Scheidegger <[email protected]>
https://bugs.freedesktop.org/show_bug.cgi?id=100303
Diffstat (limited to 'src/compiler/glsl/lower_jumps.cpp')
-rw-r--r-- | src/compiler/glsl/lower_jumps.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp index e165172301a..7dc34056a1b 100644 --- a/src/compiler/glsl/lower_jumps.cpp +++ b/src/compiler/glsl/lower_jumps.cpp @@ -945,6 +945,12 @@ lower_continue: */ if (this->function.signature->return_type->is_void()) return_if->then_instructions.push_tail(new(ir) ir_return(NULL)); + else { + assert(this->function.return_value); + ir_variable* return_value = this->function.return_value; + return_if->then_instructions.push_tail( + new(ir) ir_return(new(ir) ir_dereference_variable(return_value))); + } } ir->insert_after(return_if); |