texld - ps_1_4
Loads the destination register with color data (RGBA) sampled using the contents of the source register as texture coordinates. The sampled texture is the texture associated with the destination register number.
texld dst, src |
---|
Registers
Value | Description | vₙ | cₙ | tₙ | rₙ | Pixel shader version |
---|---|---|---|---|---|---|
dst | Destination register | x | 1_4 | |||
src | Source register | x | 1_4 phase 1 | |||
x | x | 1_4 phase |
When using r(n) as a source register, the first three components (XYZ) must have been initialized in the previous phase of the shader.
To learn more about registers, see ps_1_1__ps_1_2__ps_1_3__ps_1_4 Registers.
Remarks
This instruction samples the texture in the texture stage associated with the destination register number. The texture is sampled using texture coordinate data from the source register.
The syntax for the texld and texcrd instructions expose support for a projective divide with a Texture Register Modifier. For pixel shader version 1.4, the D3DTTFF_PROJECTED texture transform flag is always ignored.
Rules for using texld:
- The same .xyz or .xyw modifier must be applied to every read of an individual t(n) register within both texcrd or texld instructions. If .xyw is being used on t(n) register reads, this can be mixed with other reads of the same t(n) register using .xyw_dw.
- The _dz source modifier is only valid on texld with r(n) source register (thus phase 2 only).
- The _dz source modifier may be used no more than two times per shader.
Pixel shader versions | 1_1 | 1_2 | 1_3 | 1_4 | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
---|---|---|---|---|---|---|---|---|---|
texld | x |
Examples
The texld instruction offers some control over which components of the source texture coordinate data are used. The complete set of allowed syntax for texld follows, and includes all valid source register modifiers, selectors, and write mask combinations.
texld r(m), t(n).xyz
// Uses xyz from t(n) to sample 1D, 2D, or 3D texture
texld r(m), t(n)
// Same as previous
texld r(m), t(n).xyw
// Uses xyw (skipping z) from t(n) to sample 1D, 2D or 3D texture
texld r(m), t(n)_dw.xyw
// Samples 1D or 2D texture at x/w, y/w from t(n). The result
// is undefined for a cube-map lookup.
texld r(m), r(n).xyz
// Samples 1D, 2D, or 3D texture at xyz from r(m)
// This is possible in the second phase of the shader
texld r(m), r(n)
// Same as previous
texld r(m), r(n)_dz.xyz
// Samples 1D or 2D texture at x/z, y/z from r(m)
// Possible only in second phase
// The result is undefined for a cube-map lookup
texld r(n), r(n)_dz
// Same as previous
Related topics