aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/r500_fragprog.c
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2008-05-26 22:34:32 -0700
committerCorbin Simpson <[email protected]>2008-05-27 01:36:25 -0700
commit9412aee4dc6a94ffc3d4043e8c843ba051f5507b (patch)
tree2d5022556b2445808d22d29736855c5fa5352635 /src/mesa/drivers/dri/r300/r500_fragprog.c
parenteee53dfb22e0c950b11a466ebcd5d764864229cd (diff)
r5xx: Fix emit_mov() regression.
Specifically, fix improper swizzling.
Diffstat (limited to 'src/mesa/drivers/dri/r300/r500_fragprog.c')
-rw-r--r--src/mesa/drivers/dri/r300/r500_fragprog.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c
index 911e6ae81e3..2315830a59c 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog.c
@@ -138,6 +138,19 @@ static inline GLuint make_rgb_swizzle(struct prog_src_register src) {
return swiz;
}
+static inline GLuint make_rgba_swizzle(GLuint src) {
+ GLuint swiz = 0x0;
+ GLuint temp;
+ int i;
+ for (i = 0; i < 4; i++) {
+ temp = GET_SWZ(src, i);
+ /* Fix SWIZZLE_ONE */
+ if (temp == 5) temp++;
+ swiz |= temp << i*3;
+ }
+ return swiz;
+}
+
static inline GLuint make_alpha_swizzle(struct prog_src_register src) {
GLuint swiz = GET_SWZ(src.Swizzle, 3);
@@ -364,6 +377,8 @@ static void emit_mov(struct r500_fragment_program *fp, int counter, struct prog_
emit_alu(fp, counter, fpi);
fp->inst[counter].inst1 = R500_RGB_ADDR0(src_reg);
fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src_reg);
+ /* (De)mangle the swizzle from Mesa to R500. */
+ swizzle = make_rgba_swizzle(swizzle);
/* 0x1FF is 9 bits, size of an RGB swizzle. */
fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0
| MAKE_SWIZ_RGB_A((swizzle & 0x1ff))