From 3cdff41d9245f997c465869148a74a2041739504 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 13 Oct 2010 23:45:12 -0700 Subject: r300/compiler: Clear empty registers after constant folding --- src/mesa/drivers/dri/r300/compiler/radeon_optimize.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index 41769e347e..e895841ed4 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -408,6 +408,7 @@ static void constant_folding_add(struct rc_instruction * inst) static void constant_folding(struct radeon_compiler * c, struct rc_instruction * inst) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + unsigned int i; /* Replace 0.0, 1.0 and 0.5 immediates by their explicit swizzles */ for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { @@ -480,6 +481,13 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * constant_folding_mul(inst); else if (inst->U.I.Opcode == RC_OPCODE_ADD) constant_folding_add(inst); + + /* In case this instruction has been converted, make sure all of the + * registers that are no longer used are empty. */ + opcode = rc_get_opcode_info(inst->U.I.Opcode); + for(i = opcode->NumSrcRegs; i < 3; i++) { + memset(&inst->U.I.SrcReg[i], 0, sizeof(struct rc_src_register)); + } } /** -- cgit v1.2.3