r300/compiler: Ignore alpha dest register when replicating the result
authorTom Stellard <tstellar@gmail.com>
Thu, 11 Nov 2010 09:13:01 +0000 (01:13 -0800)
committerTom Stellard <tstellar@gmail.com>
Mon, 22 Nov 2010 02:48:31 +0000 (18:48 -0800)
When the result of the alpha instruction is being replicated to the RGB
destination register, we do not need to use alpha's destination register.
This fixes an invalid "Too many hardware temporaries used" error in
the case where a transcendent operation writes to a temporary register
greater than max_temp_regs.

NOTE: This is a candidate for the 7.9 branch.

src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c

index c549be52183891867e2153b783a78aacef853f5f..fc05366f50ee3d8bfb45af2991dbe90696a8e295 100644 (file)
@@ -280,9 +280,12 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
                        pair->RGB.DestIndex = inst->DstReg.Index;
                        pair->RGB.WriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ;
                }
+
                if (needalpha) {
-                       pair->Alpha.DestIndex = inst->DstReg.Index;
                        pair->Alpha.WriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
+                       if (pair->Alpha.WriteMask) {
+                               pair->Alpha.DestIndex = inst->DstReg.Index;
+                       }
                }
        }