diff options
author | Paul Berry <stereotype441@gmail.com> | 2011-07-01 15:33:36 -0700 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2011-10-02 18:45:10 +0200 |
commit | 38ae26b709fb9b964628ea9e9a43efb4e2dd49a0 (patch) | |
tree | 56eed170111a26560c6900b46b9d7361d62c7965 | |
parent | de798938d4e7bc65a3a859be76dcf831eb927068 (diff) |
glsl: In lower_jumps.cpp, lower both branches of a conditional.
Previously, lower_jumps.cpp would break out of its loop after lowering
a jump instruction in just the then- or else-branch of a conditional,
and it would fail to lower a jump instruction occurring in the other
branch.
Without this patch, lower_jumps.cpp may require multiple passes in
order to lower all jumps. This results in sub-optimal output because
lower_jumps.cpp produces a brand new set of temporary variables each
time it is run, and the redundant temporary variables are not
guaranteed to be eliminated by later optimization passes.
Fixes unit test test_lower_returns_4.
(cherry picked from commit e71b4ab8a64bf978b2036976a41e30996eebb0c8)
-rw-r--r-- | src/glsl/lower_jumps.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/lower_jumps.cpp b/src/glsl/lower_jumps.cpp index 638594f0381..9378ab93086 100644 --- a/src/glsl/lower_jumps.cpp +++ b/src/glsl/lower_jumps.cpp @@ -451,7 +451,10 @@ lower_continue: block_records[lower].min_strength = strength_always_clears_execute_flag; block_records[lower].may_clear_execute_flag = true; this->progress = true; - break; + + /* Let the loop run again, in case the other branch of the + * if needs to be lowered too. + */ } } |