diff options
author | Tom Stellard <tstellar@gmail.com> | 2010-10-05 22:53:40 -0700 |
---|---|---|
committer | Tom Stellard <tstellar@gmail.com> | 2010-10-18 20:51:05 -0700 |
commit | 75734d0a37c7cb24fb97c9ba0166f9f2d2da60f8 (patch) | |
tree | 8c616f3838f1927f0b14adf532f4cabad06e83cd /src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c | |
parent | ad683577b202750ffac917392d50fb7202d5bf2a (diff) |
r300/compiler: Fix incorrect assumption
It is possible for a single pair instruction arg to select from both an
RGB and an Alpha source.
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c index c31efdb059..a21fe8d3df 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c @@ -206,34 +206,22 @@ void rc_pair_foreach_source_that_rgb_reads( /*return 0 for rgb, 1 for alpha -1 for error. */ -rc_pair_source_type rc_source_type_that_arg_reads( +unsigned int rc_source_type_that_arg_reads( unsigned int source, - unsigned int swizzle, - unsigned int channels) + unsigned int swizzle) { unsigned int chan; unsigned int swz = RC_SWIZZLE_UNUSED; - int isRGB = 0; - int isAlpha = 0; - /* Find a swizzle that is either X,Y,Z,or W. We assume here - * that if one channel swizzles X,Y, or Z, then none of the - * other channels swizzle W, and vice-versa. */ - for(chan = 0; chan < channels; chan++) { + unsigned int ret = RC_PAIR_SOURCE_NONE; + + for(chan = 0; chan < 3; chan++) { swz = GET_SWZ(swizzle, chan); if (swz == RC_SWIZZLE_W) { - isAlpha = 1; + ret |= RC_PAIR_SOURCE_ALPHA; } else if (swz == RC_SWIZZLE_X || swz == RC_SWIZZLE_Y || swz == RC_SWIZZLE_Z) { - isRGB = 1; + ret |= RC_PAIR_SOURCE_RGB; } } - assert(!isRGB || !isAlpha); - - if(!isRGB && !isAlpha) - return RC_PAIR_SOURCE_NONE; - - if (isRGB) - return RC_PAIR_SOURCE_RGB; - /*isAlpha*/ - return RC_PAIR_SOURCE_ALPHA; + return ret; } |