diff options
author | Tom Stellard <[email protected]> | 2011-10-01 21:06:12 -0700 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2011-10-02 15:21:15 -0700 |
commit | b5ecf5ba466c3e1872dc9281b01f4e59ca1a388b (patch) | |
tree | d51245dfb836c79bbc6c22a759e9f019682774d9 /src/gallium/drivers/r300/compiler/radeon_compiler_util.c | |
parent | e7c2b711a3b01cbeb0bf93d5442599457e7f8f51 (diff) |
r300/compiler: Use consistent src swizzles for transcendent instructions
Source swizzles for transcendent instructions were being stored in the X
channel regardless of what channel the instruction was writing.
This was causing problems for some helper functions that were expecting
source swizzles to occupy channels corresponding to the instruction's
writemask. This commit makes transcendent instructions follow the same
convention as normal instructions for representing source swizzles.
Previous behavior:
LG2 temp[0].y, input[0].x___;
Current behavior:
LG2 temp[0].y, input[0]._x__;
Diffstat (limited to 'src/gallium/drivers/r300/compiler/radeon_compiler_util.c')
-rw-r--r-- | src/gallium/drivers/r300/compiler/radeon_compiler_util.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c index 33dbe0e86e9..36a634114d6 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c +++ b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c @@ -734,3 +734,21 @@ float rc_get_constant_value( return base * c->Program.Constants.Constants[index].u.Immediate[swz]; } + +/** + * This function returns the component value (RC_SWIZZLE_*) of the first used + * channel in the swizzle. This is only useful for scalar instructions that are + * known to use only one channel of the swizzle. + */ +unsigned int rc_get_scalar_src_swz(unsigned int swizzle) +{ + unsigned int swz, chan; + for (chan = 0; chan < 4; chan++) { + swz = GET_SWZ(swizzle, chan); + if (swz != RC_SWIZZLE_UNUSED) { + break; + } + } + assert(swz != RC_SWIZZLE_UNUSED); + return swz; +} |