aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-03-08 06:37:50 +0100
committerMarek Olšák <[email protected]>2011-03-08 06:37:50 +0100
commit4f3826117957b5ac1554b833af33d342360f655a (patch)
tree89d830654f5ecbd3274df306b5c85f869dabe57d /src/mesa/drivers/dri/r300
parenteb1acd16130a2945122d373357ee72585e520755 (diff)
r300/compiler: improve the detection of constants for constant folding
Now the expression V==0 generates one instruction instead of two.
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_optimize.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
index 5caff91b00e..3915cb475be 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
@@ -312,6 +312,13 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction *
struct rc_src_register newsrc;
int have_real_reference;
+ if (inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_1111 ||
+ inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_0000 ||
+ inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_HHHH) {
+ inst->U.I.SrcReg[src].File = RC_FILE_NONE;
+ continue;
+ }
+
if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT ||
inst->U.I.SrcReg[src].RelAddr ||
inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count)