Mesa (7.9): r300/compiler: fix shadow sampling with swizzled coords
Marek Olšák
mareko at kemper.freedesktop.org
Tue Sep 28 17:59:54 UTC 2010
Module: Mesa
Branch: 7.9
Commit: 5c3be43cd26838cf216bb089fc9eead88906e0e2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c3be43cd26838cf216bb089fc9eead88906e0e2
Author: Marek Olšák <maraeo at gmail.com>
Date: Tue Sep 28 19:51:19 2010 +0200
r300/compiler: fix shadow sampling with swizzled coords
Taking the W component from coords directly ignores swizzling. Instead,
take the component which is mapped to W in the TEX instruction parameter.
The same for Z.
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 7128e1625bea502b9bf083f14606d679c90222a6)
Conflicts:
src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
---
.../drivers/dri/r300/compiler/radeon_program_tex.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
index 42c8b59..6c3ce6c 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
@@ -174,16 +174,18 @@ int radeonTransformTEX(
inst_rcp->U.I.DstReg.Index = tmp_recip_w;
inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W;
inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0];
- inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW;
+ inst_rcp->U.I.SrcReg[0].Swizzle =
+ RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3));
}
- /* Perspective-divide r by W (if it's TXP) and add the texture sample (see below). */
+ /* Perspective-divide Z by W (if it's TXP) and add the texture sample (see below). */
tmp_sum = rc_find_free_temporary(c);
inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst);
inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY;
inst_mad->U.I.DstReg.Index = tmp_sum;
inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0];
- inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ;
+ inst_mad->U.I.SrcReg[0].Swizzle =
+ RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 2));
if (inst->U.I.Opcode == RC_OPCODE_TXP) {
inst_mad->U.I.Opcode = RC_OPCODE_MAD;
inst_mad->U.I.SrcReg[1].File = RC_FILE_TEMPORARY;
More information about the mesa-commit
mailing list