Source Register Signed Scaling
Subtracts 0.5 from each channel and scales the result by 2.0. The name bx2 comes from bias and scale-times-two, which is the operation it performs.
Source Register. For more about register types, see ps_1_1__ps_1_2__ps_1_3__ps_1_4 Registers.
This operation is commonly used to expand data from [0.0 to 1.0] to [-1.0 to 1.0]. This modifier is designed for use with the arithmetic instructions. This modifier is commonly used on inputs to the dot product instruction (dp3 - ps). Using _bx2 on data outside the range 0 to 1 may produce undefined results.
The signed scaling operation is applied to the data read from the register before the next instruction is run. The operation is applied to all four color channels (RGBA) as follows:
y = 2(x - 0.5)
The contents of the register are not changed. The modifier is applied only to the data read from the register.
This modifier is mutually exclusive with Source Register Invert so it cannot be applied to the same register.
- For ps_1_0 and ps_1_1, you can use _bx2 on any source register for texture instructions of the form texm3x2* and texm3x3*. _bx2 cannot be used on any of the other texture instructions such as texreg2ar - ps or texreg2gb - ps.
- For ps_1_2 and ps_1_3, you can use _bx2 on any source register for any tex* instruction except: texreg2ar - ps, texreg2gb - ps, texbem - ps or texbeml - ps.
This example samples a texture, converts data to the range of -1 to +1, and calculates a dot product.
tex t0 ; Read a texture color. dp3_sat r0, t0_bx2, v0_bx2 ; Calculate a dot product.