From: Tom Stellard <[email protected]> This fixes bug:
https://bugs.freedesktop.org/show_bug.cgi?id=25109 --- .../dri/r300/compiler/radeon_pair_schedule.c | 39 +++++++++++++------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index a279549..0641be5 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -208,21 +208,32 @@ static void emit_all_tex(struct schedule_state * s, struct rc_instruction * befo assert(s->ReadyTEX); - /* Don't let the ready list change under us! */ - readytex = s->ReadyTEX; - s->ReadyTEX = 0; - - /* Node marker for R300 */ - struct rc_instruction * inst_begin = rc_insert_new_instruction(s->C, before->Prev); - inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX; - - /* Link texture instructions back in */ - while(readytex) { - struct schedule_instruction * tex = readytex; - readytex = readytex->NextReady; + if(s->ReadyTEX){ + /* Node marker for R300 */ + struct rc_instruction * inst_begin = + rc_insert_new_instruction(s->C, before->Prev); + inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX; + } - rc_insert_instruction(before->Prev, tex->Instruction); - commit_instruction(s, tex); + /* The purpose of this outer loop is to emit TEX instruction that + * have become ready as a result of the inner loop. This prevents + * the fragmentation of TEX blocks, which for some shaders (in Civ4 + * for example) was creating too many texture indirections on r300 + * cards. + */ + while(s->ReadyTEX){ + /* Don't let the ready list change under us! */ + readytex = s->ReadyTEX; + s->ReadyTEX = 0; + + /* Link texture instructions back in */ + while(readytex) { + struct schedule_instruction * tex = readytex; + readytex = readytex->NextReady; + + rc_insert_instruction(before->Prev, tex->Instruction); + commit_instruction(s, tex); + } } } -- 1.6.4.4 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
