summaryrefslogtreecommitdiffstats
path: root/src/glsl/loop_unroll.cpp
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-05 22:29:58 +0200
committerIan Romanick <[email protected]>2010-09-08 20:36:37 -0700
commite591c4625cae63660c5000fbab366e40fe154ab0 (patch)
tree06b65ce727933c9bc7be208085c7400ed5b37f6f /src/glsl/loop_unroll.cpp
parent6d3a2c97f4a78e85545286e0e126cd3a27bd1cbd (diff)
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 <[email protected]>
Diffstat (limited to 'src/glsl/loop_unroll.cpp')
-rw-r--r--src/glsl/loop_unroll.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index e204251e9cc..80f92171590 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);