tex - ps

Loads the destination register with color data (RGBA) sampled from a texture. The texture must be bound to a particular texture stage (n) using SetTexture. Texture sampling is controlled by SetSamplerState.

Syntax

tex dst

 

where

  • dst is the destination register.

Remarks

Pixel shader versions 1_1 1_2 1_3 1_4 2_0 2_x 2_sw 3_0 3_sw
tex x x x

 

The destination register number specifies the texture stage number.

Texture sampling uses texture coordinates to look up, or sample, a color value at the specified (u,v,w,q) coordinates while taking into account the texture stage state attributes.

The texture coordinate data is interpolated from the vertex texture coordinate data and is associated with a specific texture stage. The default association is a one-to-one mapping between texture stage number and texture coordinate declaration order. This means that the first set of texture coordinates defined in the vertex format are by default associated with texture stage 0.

Texture coordinates may be associated with any stage using two techniques. When using a fixed function vertex shader or the fixed function pipeline, the texture stage state flag TSS_TEXCOORDINDEX can be used in SetTextureStageState to associate coordinates to a stage. Otherwise, the texture coordinates are output by the vertex shader oTâ‚™ registers when using a programmable vertex shader.

Pixel Shader Instructions