diff options
author | Tom Stellard <[email protected]> | 2010-06-24 18:45:46 -0700 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-07-03 04:32:41 +0200 |
commit | 7da9e1e61b4dbd627404941f72d2f7a40dc9153b (patch) | |
tree | 1041572a0949506e17a8732b9ee0c8b1d24eff5d /src/mesa/drivers | |
parent | f381c52081b2cbff31c2f38abf16dffcc08f681c (diff) |
r300/compiler: Fix loop unrolling
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c index 696cfd5ddc9..131e9e7436d 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c @@ -267,8 +267,22 @@ static int transform_const_loop(struct emulate_loop_state * s, * simple, since we only support increment and decrement loops. */ limit_value = get_constant_value(s->C, limit, 0); - iterations = (int) ((limit_value - counter_value.Value) / + DBG("Limit is %f.\n", limit_value); + switch(loop->Cond->U.I.Opcode){ + case RC_OPCODE_SGT: + case RC_OPCODE_SLT: + iterations = (int) ceilf((limit_value - counter_value.Value) / count_inst.Amount); + break; + + case RC_OPCODE_SLE: + case RC_OPCODE_SGE: + iterations = (int) floorf((limit_value - counter_value.Value) / + count_inst.Amount) + 1; + break; + default: + return 0; + } DBG("Loop will have %d iterations.\n", iterations); |