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_bx2


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.

Version information:


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.

Related topics

Pixel Shader Source Register Modifiers