summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2010-08-03 20:17:00 -0700
committerTom Stellard <[email protected]>2010-08-03 20:17:00 -0700
commit09c8fa570e69272f65cb49840ec7c709820b1b2a (patch)
tree5e05ee15048837b677de5f4eb883bf2a6c51540d /src
parent2824d5687a19e42ba0da8fd08e80610c4469a3b3 (diff)
r300/compiler: Always unroll loops when doing loop emulation.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c17
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h2
4 files changed, 14 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index 070939497ce..c6246a81a24 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -113,7 +113,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
debug_program_log(c, "after unroll loops");
}
else{
- rc_transform_loops(&c->Base, &loop_state, R300_PFS_MAX_ALU_INST);
+ rc_transform_loops(&c->Base, &loop_state);
debug_program_log(c, "after transform loops");
rc_emulate_branches(&c->Base);
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index fe34ff67cdc..e940fedec20 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -645,11 +645,11 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler)
* on all chipsets. */
if (compiler->Base.is_r500){
- rc_transform_loops(&compiler->Base, &loop_state, R500_VS_MAX_ALU);
+ rc_transform_loops(&compiler->Base, &loop_state);
rc_emulate_loops(&loop_state, R500_VS_MAX_ALU);
} else {
+ rc_transform_loops(&compiler->Base, &loop_state);
rc_emulate_loops(&loop_state, R300_VS_MAX_ALU);
- rc_transform_loops(&compiler->Base, &loop_state, R300_VS_MAX_ALU);
}
debug_program_log(compiler, "after emulate loops");
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 94e3e5f4f51..24c3ae57b6e 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
@@ -186,6 +186,10 @@ static void get_incr_amount(void * data, struct rc_instruction * inst,
}
}
+/**
+ * If prog_inst_limit is -1, then all eligible loops will be unrolled regardless
+ * of how many iterations they have.
+ */
static int try_unroll_loop(struct radeon_compiler * c, struct loop_info * loop,
unsigned int prog_inst_limit)
{
@@ -296,7 +300,8 @@ static int try_unroll_loop(struct radeon_compiler * c, struct loop_info * loop,
return 0;
}
- if (iterations > loop_max_possible_iterations(c, loop,
+ if (prog_inst_limit > 0
+ && iterations > loop_max_possible_iterations(c, loop,
prog_inst_limit)) {
return 0;
}
@@ -422,8 +427,7 @@ static int build_loop_info(struct radeon_compiler * c, struct loop_info * loop,
* Null if there is an error.
*/
static struct rc_instruction * transform_loop(struct emulate_loop_state * s,
- struct rc_instruction * inst,
- int prog_inst_limit)
+ struct rc_instruction * inst)
{
struct loop_info * loop;
@@ -435,7 +439,7 @@ static struct rc_instruction * transform_loop(struct emulate_loop_state * s,
if (!build_loop_info(s->C, loop, inst))
return NULL;
- if(try_unroll_loop(s->C, loop, prog_inst_limit)){
+ if(try_unroll_loop(s->C, loop, -1)){
return loop->BeginLoop->Next;
}
@@ -472,8 +476,7 @@ static struct rc_instruction * transform_loop(struct emulate_loop_state * s,
}
void rc_transform_loops(struct radeon_compiler *c,
- struct emulate_loop_state * s,
- int prog_inst_limit)
+ struct emulate_loop_state * s)
{
struct rc_instruction * ptr;
@@ -483,7 +486,7 @@ void rc_transform_loops(struct radeon_compiler *c,
while(ptr != &s->C->Program.Instructions) {
if(ptr->Type == RC_INSTRUCTION_NORMAL &&
ptr->U.I.Opcode == RC_OPCODE_BGNLOOP){
- ptr = transform_loop(s, ptr, prog_inst_limit);
+ ptr = transform_loop(s, ptr);
if(!ptr){
return;
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
index 339527ba3bd..86d91ef14bd 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
@@ -24,7 +24,7 @@ struct emulate_loop_state {
};
void rc_transform_loops(struct radeon_compiler *c,
- struct emulate_loop_state * s, int prog_inst_limit);
+ struct emulate_loop_state * s);
void rc_unroll_loops(struct radeon_compiler * c, int prog_inst_limit);