summaryrefslogtreecommitdiff
path: root/src/glsl/glsl_parser_extras.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-01-17 22:07:55 -0800
committerEric Anholt <eric@anholt.net>2011-01-18 10:17:37 -0800
commit58c988ada56114b56477983f66b4039219f1a82c (patch)
tree0599f47a88746a3176894b9b492ade28bf5f37ed /src/glsl/glsl_parser_extras.cpp
parent754b9c5363aa7ae5f47c88c78790b3fe35c07403 (diff)
glsl: Skip the rest of loop unrolling if no loops were found.
Shaves 1.6% (+/- 1.0%) off of ff_fragment_shader glean texCombine time (n=5).
Diffstat (limited to 'src/glsl/glsl_parser_extras.cpp')
-rw-r--r--src/glsl/glsl_parser_extras.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index cbeacd5633..77885d4e1e 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -748,8 +748,10 @@ do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iteration
progress = optimize_redundant_jumps(ir) || progress;
loop_state *ls = analyze_loop_variables(ir);
- progress = set_loop_controls(ir, ls) || progress;
- progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
+ if (ls->loop_found) {
+ progress = set_loop_controls(ir, ls) || progress;
+ progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
+ }
delete ls;
return progress;