?/TD>
Microsoft DirectX 9.0

Signed Scaling


Subtracts 0.5 from each channel and scales the result by 2.0. The name "bx2" comes from biastimes two, which is the operation it performs.

Syntax

source register_bx2

Register

Source Register. For more about register types, see Registers - ps_1_X.

Remarks

The contents of the register are not changed. The modifier is applied only to the data read from the register.

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)

This operation is commonly used to expand data from [0.0 to 1.0] to [-1.0 to 1.0]. Using _bx2 on data outside the range 0 to 1 may produce undefined results.

This modifier is designed for use with the arithmetic instructions. This modifier is commonly used on inputs to the dot product instruction (dp3).

This modifier is mutually exclusive with Invert so it cannot be applied to the same register.

For shader version 1_1, input arguments to any of the texture address instructions of the form texm3x2* and texm3x3* can use the _bx2 modifier.

For shader versions 1_2 and 1_3, the source register to any tex* instruction can use the _bx2 modifier. For version 1_0 and 1_1, _bx2 cannot be used on the source register for texreg2ar or texreg2gb.

Example

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.


© 2002 Microsoft Corporation. All rights reserved.