From e591c4625cae63660c5000fbab366e40fe154ab0 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 5 Sep 2010 22:29:58 +0200 Subject: glsl: add several EmitNo* options, and MaxUnrollIterations This increases the chance that GLSL programs will actually work. Note that continues and returns are not yet lowered, so linking will just fail if not supported. Signed-off-by: Ian Romanick --- src/glsl/loop_unroll.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/glsl/loop_unroll.cpp') diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp index e204251e9c..80f9217159 100644 --- a/src/glsl/loop_unroll.cpp +++ b/src/glsl/loop_unroll.cpp @@ -27,10 +27,11 @@ class loop_unroll_visitor : public ir_hierarchical_visitor { public: - loop_unroll_visitor(loop_state *state) + loop_unroll_visitor(loop_state *state, unsigned max_iterations) { this->state = state; this->progress = false; + this->max_iterations = max_iterations; } virtual ir_visitor_status visit_leave(ir_loop *ir); @@ -38,6 +39,7 @@ public: loop_state *state; bool progress; + unsigned max_iterations; }; @@ -62,7 +64,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) /* Don't try to unroll loops that have zillions of iterations either. */ - if (ls->max_iterations > 32) + if (ls->max_iterations > max_iterations) return visit_continue; if (ls->num_loop_jumps > 0) @@ -90,9 +92,9 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) bool -unroll_loops(exec_list *instructions, loop_state *ls) +unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations) { - loop_unroll_visitor v(ls); + loop_unroll_visitor v(ls, max_iterations); v.run(instructions); -- cgit v1.2.3