diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-11-25 04:34:31 +0100 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2010-11-26 02:23:13 +0100 |
commit | ea2f56b49026dce4f0e507b587fd58b18b5de1ec (patch) | |
tree | 4386053e28ebd06ef5162226b928656f328cec4d /src/mesa/drivers/dri/r300/compiler/radeon_program.h | |
parent | 7c294462324fd3dc1951fc003290b926fbc0b07e (diff) |
r300/compiler: add a function for swizzling a mask
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/radeon_program.h')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_program.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index 913815b24d..772ea14df3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -204,6 +204,20 @@ static inline rc_swizzle rc_mask_to_swizzle(unsigned int mask) } return RC_SWIZZLE_UNUSED; } + +/* Reorder mask bits according to swizzle. */ +static inline unsigned swizzle_mask(unsigned swizzle, unsigned mask) +{ + unsigned ret = 0; + for (unsigned chan = 0; chan < 4; ++chan) { + unsigned swz = GET_SWZ(swizzle, chan); + if (swz < 4) + ret |= GET_BIT(mask, swz) << chan; + } + return ret; +} + + struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg); static inline void reset_srcreg(struct rc_src_register* reg) |