rendered paste bodydiff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.cindex b53571a..dd0da0c 100644--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c@@ -175,6 +175,13 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) debug_program_log(c, "after dataflow passes"); + if(!c->Base.is_r500){+ rc_rename_tex_dst_regs(c);+ if (c->Base.Error)+ return;+ debug_program_log(c, "after tex rename");+ }+ rc_pair_translate(c); if (c->Base.Error) return;diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.cindex 9c4b65f..ea27ef4 100644--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c@@ -27,6 +27,11 @@ #include "radeon_program_tex.h" +struct reg_rename {+ int old_index;+ int new_index;+};+ /* Series of transformations to be done on textures. */ static struct rc_src_register shadow_ambient(struct r300_fragment_program_compiler *compiler,@@ -387,3 +392,43 @@ int radeonTransformTEX( return 1; }++static void rename_regs(void * data, struct rc_instruction * inst,+ rc_register_file * file, unsigned int * index)+{+ struct reg_rename *r = data;+ if(r->old_index == *index && *file == RC_FILE_TEMPORARY){+ *index = r->new_index;+ }+}++void rc_rename_tex_dst_regs(struct r300_fragment_program_compiler *c)+{+ char used_regs[RC_REGISTER_MAX_INDEX];+ struct rc_instruction * inst;+ memset(used_regs, 0, sizeof(used_regs));++ for(inst = c->Base.Program.Instructions.Next;+ inst != &c->Base.Program.Instructions;+ inst = inst->Next){+ struct rc_instruction * temp;+ struct reg_rename r;+ const struct rc_opcode_info * info =+ rc_get_opcode_info(inst->U.I.Opcode);+ if(!info->HasTexture || !info->HasDstReg){+ continue;+ }+ r.old_index = inst->U.I.DstReg.Index;+ if(!used_regs[r.old_index]){+ used_regs[r.old_index] = 1;+ continue;+ }++ r.new_index = rc_find_free_temporary(&c->Base);+ for(temp = inst; temp != &c->Base.Program.Instructions;+ temp = temp->Next){+ rc_remap_registers(temp, rename_regs, &r);+ }+ used_regs[r.new_index] = 1;+ }+}diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.hindex a010505..f9e37c0 100644--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.h+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.h@@ -36,4 +36,6 @@ int radeonTransformTEX( struct rc_instruction * inst, void* data); +void rc_rename_tex_dst_regs(struct r300_fragment_program_compiler * c);+ #endif /* __RADEON_PROGRAM_TEX_H_ */