From 3f5382819e31071c2af6cb39c1ca09bf3243f83f Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 11 Jul 2009 19:10:58 +0200 Subject: [PATCH] r300: fix swizzle masking in getUsedComponents --- src/mesa/drivers/dri/r300/r300_vertprog.c | 12 ++++++++---- 1 file 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; } -- 2.30.2