summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaciej Cencora <[email protected]>2009-07-11 19:10:58 +0200
committerMaciej Cencora <[email protected]>2009-07-13 19:28:15 +0200
commit3f5382819e31071c2af6cb39c1ca09bf3243f83f (patch)
tree9e46d09810b05ed3e22245ba1799205f7905ccd2 /src
parentacd33600411102872af579edc4206b61eb51bb65 (diff)
r300: fix swizzle masking in getUsedComponents
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 703fba48744..9f807dbc993 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -1524,10 +1524,14 @@ static GLuint getUsedComponents(const GLuint swizzle)
ret = 0;
/* need to mask out ZERO, ONE and NIL swizzles */
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_X) & 0x3);
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_Y) & 0x3);
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_Z) & 0x3);
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_W) & 0x3);
+ if (GET_SWZ(swizzle, SWIZZLE_X) <= SWIZZLE_W)
+ ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_X));
+ if (GET_SWZ(swizzle, SWIZZLE_Y) <= SWIZZLE_W)
+ ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_Y));
+ if (GET_SWZ(swizzle, SWIZZLE_Z) <= SWIZZLE_W)
+ ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_Z));
+ if (GET_SWZ(swizzle, SWIZZLE_W) <= SWIZZLE_W)
+ ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_W));
return ret;
}