Go to the source code of this file.
Functions | |
unsigned | tgsi_util_get_src_register_swizzle (const struct tgsi_src_register *reg, unsigned component) |
unsigned | tgsi_util_get_src_register_extswizzle (const struct tgsi_src_register_ext_swz *reg, unsigned component) |
unsigned | tgsi_util_get_full_src_register_extswizzle (const struct tgsi_full_src_register *reg, unsigned component) |
unsigned | tgsi_util_get_src_register_extnegate (const struct tgsi_src_register_ext_swz *reg, unsigned component) |
void | tgsi_util_set_src_register_extnegate (struct tgsi_src_register_ext_swz *reg, unsigned negate, unsigned component) |
unsigned | tgsi_util_get_full_src_register_sign_mode (const struct tgsi_full_src_register *reg, unsigned component) |
unsigned tgsi_util_get_full_src_register_extswizzle | ( | const struct tgsi_full_src_register * | reg, | |
unsigned | component | |||
) |
Definition at line 50 of file spu_util.c.
References ASSERT, assert, tgsi_full_src_register::SrcRegister, tgsi_full_src_register::SrcRegisterExtSwz, swizzle(), TGSI_EXTSWIZZLE_ONE, TGSI_EXTSWIZZLE_W, TGSI_EXTSWIZZLE_X, TGSI_EXTSWIZZLE_Y, TGSI_EXTSWIZZLE_Z, TGSI_EXTSWIZZLE_ZERO, TGSI_SWIZZLE_W, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, TGSI_SWIZZLE_Z, tgsi_util_get_src_register_extswizzle(), and tgsi_util_get_src_register_swizzle().
00053 { 00054 unsigned swizzle; 00055 00056 /* 00057 * First, calculate the extended swizzle for a given channel. This will give 00058 * us either a channel index into the simple swizzle or a constant 1 or 0. 00059 */ 00060 swizzle = tgsi_util_get_src_register_extswizzle( 00061 ®->SrcRegisterExtSwz, 00062 component ); 00063 00064 ASSERT (TGSI_SWIZZLE_X == TGSI_EXTSWIZZLE_X); 00065 ASSERT (TGSI_SWIZZLE_Y == TGSI_EXTSWIZZLE_Y); 00066 ASSERT (TGSI_SWIZZLE_Z == TGSI_EXTSWIZZLE_Z); 00067 ASSERT (TGSI_SWIZZLE_W == TGSI_EXTSWIZZLE_W); 00068 ASSERT (TGSI_EXTSWIZZLE_ZERO > TGSI_SWIZZLE_W); 00069 ASSERT (TGSI_EXTSWIZZLE_ONE > TGSI_SWIZZLE_W); 00070 00071 /* 00072 * Second, calculate the simple swizzle for the unswizzled channel index. 00073 * Leave the constants intact, they are not affected by the simple swizzle. 00074 */ 00075 if( swizzle <= TGSI_SWIZZLE_W ) { 00076 swizzle = tgsi_util_get_src_register_swizzle( 00077 ®->SrcRegister, 00078 component ); 00079 } 00080 00081 return swizzle; 00082 }
unsigned tgsi_util_get_full_src_register_sign_mode | ( | const struct tgsi_full_src_register * | reg, | |
unsigned | component | |||
) |
Definition at line 129 of file spu_util.c.
References tgsi_src_register_ext_mod::Absolute, tgsi_src_register::Negate, negate(), tgsi_src_register_ext_mod::Negate, tgsi_full_src_register::SrcRegister, tgsi_full_src_register::SrcRegisterExtMod, tgsi_full_src_register::SrcRegisterExtSwz, tgsi_util_get_src_register_extnegate(), TGSI_UTIL_SIGN_CLEAR, TGSI_UTIL_SIGN_KEEP, TGSI_UTIL_SIGN_SET, and TGSI_UTIL_SIGN_TOGGLE.
00132 { 00133 unsigned sign_mode; 00134 00135 if( reg->SrcRegisterExtMod.Absolute ) { 00136 /* Consider only the post-abs negation. */ 00137 00138 if( reg->SrcRegisterExtMod.Negate ) { 00139 sign_mode = TGSI_UTIL_SIGN_SET; 00140 } 00141 else { 00142 sign_mode = TGSI_UTIL_SIGN_CLEAR; 00143 } 00144 } 00145 else { 00146 /* Accumulate the three negations. */ 00147 00148 unsigned negate; 00149 00150 negate = reg->SrcRegister.Negate; 00151 if( tgsi_util_get_src_register_extnegate( ®->SrcRegisterExtSwz, component ) ) { 00152 negate = !negate; 00153 } 00154 if( reg->SrcRegisterExtMod.Negate ) { 00155 negate = !negate; 00156 } 00157 00158 if( negate ) { 00159 sign_mode = TGSI_UTIL_SIGN_TOGGLE; 00160 } 00161 else { 00162 sign_mode = TGSI_UTIL_SIGN_KEEP; 00163 } 00164 } 00165 00166 return sign_mode; 00167 }
unsigned tgsi_util_get_src_register_extnegate | ( | const struct tgsi_src_register_ext_swz * | reg, | |
unsigned | component | |||
) |
Definition at line 85 of file spu_util.c.
References ASSERT, assert, tgsi_src_register_ext_swz::NegateW, tgsi_src_register_ext_swz::NegateX, tgsi_src_register_ext_swz::NegateY, and tgsi_src_register_ext_swz::NegateZ.
00088 { 00089 switch( component ) { 00090 case 0: 00091 return reg->NegateX; 00092 case 1: 00093 return reg->NegateY; 00094 case 2: 00095 return reg->NegateZ; 00096 case 3: 00097 return reg->NegateW; 00098 default: 00099 ASSERT( 0 ); 00100 } 00101 return 0; 00102 }
unsigned tgsi_util_get_src_register_extswizzle | ( | const struct tgsi_src_register_ext_swz * | reg, | |
unsigned | component | |||
) |
Definition at line 30 of file spu_util.c.
References ASSERT, assert, tgsi_src_register_ext_swz::ExtSwizzleW, tgsi_src_register_ext_swz::ExtSwizzleX, tgsi_src_register_ext_swz::ExtSwizzleY, and tgsi_src_register_ext_swz::ExtSwizzleZ.
00033 { 00034 switch( component ) { 00035 case 0: 00036 return reg->ExtSwizzleX; 00037 case 1: 00038 return reg->ExtSwizzleY; 00039 case 2: 00040 return reg->ExtSwizzleZ; 00041 case 3: 00042 return reg->ExtSwizzleW; 00043 default: 00044 ASSERT( 0 ); 00045 } 00046 return 0; 00047 }
unsigned tgsi_util_get_src_register_swizzle | ( | const struct tgsi_src_register * | reg, | |
unsigned | component | |||
) |
Definition at line 10 of file spu_util.c.
References ASSERT, assert, tgsi_src_register::SwizzleW, tgsi_src_register::SwizzleX, tgsi_src_register::SwizzleY, and tgsi_src_register::SwizzleZ.
00013 { 00014 switch( component ) { 00015 case 0: 00016 return reg->SwizzleX; 00017 case 1: 00018 return reg->SwizzleY; 00019 case 2: 00020 return reg->SwizzleZ; 00021 case 3: 00022 return reg->SwizzleW; 00023 default: 00024 ASSERT( 0 ); 00025 } 00026 return 0; 00027 }
void tgsi_util_set_src_register_extnegate | ( | struct tgsi_src_register_ext_swz * | reg, | |
unsigned | negate, | |||
unsigned | component | |||
) |
Definition at line 105 of file spu_util.c.
References ASSERT, assert, tgsi_src_register_ext_swz::NegateW, tgsi_src_register_ext_swz::NegateX, tgsi_src_register_ext_swz::NegateY, and tgsi_src_register_ext_swz::NegateZ.
00109 { 00110 switch( component ) { 00111 case 0: 00112 reg->NegateX = negate; 00113 break; 00114 case 1: 00115 reg->NegateY = negate; 00116 break; 00117 case 2: 00118 reg->NegateZ = negate; 00119 break; 00120 case 3: 00121 reg->NegateW = negate; 00122 break; 00123 default: 00124 ASSERT( 0 ); 00125 } 00126 }