Mesa (7.9): r300/compiler: Fix vertex shader MAD instructions with constant swizzles
Tom Stellard
tstellar at kemper.freedesktop.org
Tue Apr 5 16:43:32 UTC 2011
Module: Mesa
Branch: 7.9
Commit: b8050add5669ccc91ff658222ce97682886f2a2f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8050add5669ccc91ff658222ce97682886f2a2f
Author: Tom Stellard <tstellar at gmail.com>
Date: Tue Apr 5 00:04:45 2011 -0700
r300/compiler: Fix vertex shader MAD instructions with constant swizzles
(cherry picked from commit d8361400b76dde6fb63df6c363b7dd59c5946e09)
---
src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index 0878571..1d2285c 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -272,6 +272,7 @@ static void ei_mad(struct r300_vertex_program_code *vp,
struct rc_sub_instruction *vpi,
unsigned int * inst)
{
+ unsigned int i;
/* Remarks about hardware limitations of MAD
* (please preserve this comment, as this information is _NOT_
* in the documentation provided by AMD).
@@ -317,6 +318,23 @@ static void ei_mad(struct r300_vertex_program_code *vp,
t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
+
+ /* Arguments with constant swizzles still count as a unique
+ * temporary, so we should make sure these arguments share a
+ * register index with one of the other arguments. */
+ for (i = 0; i < 3; i++) {
+ unsigned int j;
+ if (vpi->SrcReg[i].File != RC_FILE_NONE)
+ continue;
+
+ for (j = 0; j < 3; j++) {
+ if (i != j) {
+ vpi->SrcReg[i].Index =
+ vpi->SrcReg[j].Index;
+ break;
+ }
+ }
+ }
}
inst[1] = t_src(vp, &vpi->SrcReg[0]);
inst[2] = t_src(vp, &vpi->SrcReg[1]);
More information about the mesa-commit
mailing list