diff options
author | Tom Stellard <[email protected]> | 2010-06-11 23:09:36 -0700 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-07-03 04:27:09 +0200 |
commit | 697d666d7860b3bdced32ca7fde9dea38f67da15 (patch) | |
tree | 3969cfde48c0bae7f0d763fe4080195012c320da /src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | |
parent | 91c37599f621a0ec498c0f0add14f16470ca852b (diff) |
r300/compiler: Handle loops in deadcode analysis.
This also allows us to split the loop emulation into two phases. A
tranformation phase which either unrolls loops or prepares them to be
emulated, and the emulation phase which unrolls remaining loops until the
instruction limit is reached. The second phase is completed after the
deadcode analysis in order to get a more accurate count of the number of
instructions in the body of loops.
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index bbdfa0d56f9..31f556a96af 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -97,6 +97,8 @@ static void debug_program_log(struct r300_fragment_program_compiler* c, const ch void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) { + struct emulate_loop_state loop_state; + rewrite_depth_out(c); debug_program_log(c, "before compilation"); @@ -104,14 +106,11 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) /* XXX Ideally this should be done only for r3xx, but since * we don't have branching support for r5xx, we use the emulation * on all chipsets. */ - - if (c->Base.is_r500) { - rc_emulate_loops(&c->Base, R500_PFS_MAX_INST); - } else { - rc_emulate_loops(&c->Base, R300_PFS_MAX_ALU_INST); - } - debug_program_log(c, "after emulate loops"); + rc_transform_unroll_loops(&c->Base, &loop_state); + + debug_program_log(c, "after transform loops"); + rc_emulate_branches(&c->Base); debug_program_log(c, "after emulate branches"); @@ -161,6 +160,15 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after deadcode"); + if(c->Base.is_r500){ + rc_emulate_loops(&loop_state, R500_PFS_MAX_INST); + } + else{ + rc_emulate_loops(&loop_state, R300_PFS_MAX_ALU_INST); + } + + debug_program_log(c, "after emulate looops"); + rc_optimize(&c->Base); debug_program_log(c, "after dataflow optimize"); |