Unrolls the loop with a count of 1 if it contains an unconditional return statement.
Fixes the following piglit test: /spec/glsl-1.10/execution/fs-loop-return from crashing at this assert: tgsi/tgsi_exec.c:5952:tgsi_exec_machine_run: Assertion `mach->ContStackTop == 0' failed. Signed-off-by: Lars Hamre <cheme...@gmail.com> --- NOTE: Someone with access will need to commit this after the review process src/compiler/glsl/loop_unroll.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/glsl/loop_unroll.cpp b/src/compiler/glsl/loop_unroll.cpp index bc377df..b1674e4 100644 --- a/src/compiler/glsl/loop_unroll.cpp +++ b/src/compiler/glsl/loop_unroll.cpp @@ -337,6 +337,13 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) simple_unroll(ir, 1); } + /* If the last instruction of the loop is a return statement, + * unroll the loop with a count of 1. + */ + if (last_ir->ir_type == ir_type_return) { + simple_unroll(ir, 1); + } + /* Don't try to unroll loops where the number of iterations is not known * at compile-time. */ -- 2.5.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev