diff options
author | Ian Romanick <[email protected]> | 2016-02-18 18:08:58 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-02-24 18:43:40 -0800 |
commit | 9d9aeb91b13abf455c7d650d7f6583d8ec6c3895 (patch) | |
tree | 30d1e3cc41bcf4b4cd5ec59d900befb6c745eb8d /doxygen/tnl_dd.doxy | |
parent | 3eb476fa143f0c14d3e811ee6301ce7beb4e44f1 (diff) |
glsl: Detect do-while-false loops and unroll them
Previously loops like
do {
// ...
} while (false);
that did not have any other loop-branch instructions would not be
unrolled. This is commonly used to wrap multiline preprocessor macros.
This produces IR like
(loop (
...
break
))
Since limiting_terminator was NULL, the loop unroller would
throw up its hands and say, "I don't know how many iterations. How
can I unroll this?"
We can detect this another way. If there is no limiting_terminator
and the only loop-branch is a break as the last IR, there's only one
iteration.
On my very old checkout of shader-db, this removes a loop from Orbital
Explorer, but it does not otherwise affect the shader. The loop removed
is the one the compiler inserts surrounding the switch statement.
This change does prevent some seriously bad code generation in some
patches to meta shaders that I recently sent out for review.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'doxygen/tnl_dd.doxy')
0 files changed, 0 insertions, 0 deletions