texreg2gb

DirectX8

Microsoft DirectX 8.1 (pixel shader versions 1.0, 1.1, 1.2, 1.3)

texreg2gb

Interprets the green and blue color components of the source register as texture address data to sample the texture at the stage corresponding to the destination register number.

texreg2gb dest, src

Registers

Argument Description RegistersVersion
vn cn tn rn
dest Destination register x 1.0, 1.1, 1.2, 1.3
src Source register x 1.0, 1.1, 1.2, 1.3

To learn more about registers, see Registers.

Remarks

This instruction is useful for color-space remapping operations.

// Here is an example of the sequence the instruction follows.
tex t(n)
texreg2gb t(m), t(n)     where m > n

// Here is more detail about how the remapping is accomplished.
// The first instruction loads the texture color (RGBA) into register tn.
tex tn 
// The second instruction remaps the color.
t(m)RGBA = TextureSample(stage m)RGBA using t(n)GB as coordinates.

For this instruction, the source register must use unsigned data. Use of signed or mixed data in the source register will produce undefined results. For more information, see D3DFORMAT.