Microsoft Directx 8.1 (pixel shader version 1.4) |
Texture Register Modifiers for texld and texcrd
Two pixel shader version 1.4 texture address instructions, texld and texcrd, have custom syntax. These instructions support their own set of source register modifiers, source register selectors, and destination-register write masks, as shown below.
Source Register Modifiers for texld and texcrd
These modifiers provide projective divide functionality by dividing the x and y values by either the z or w values.
Source register modifiers | Description | Syntax | Version |
---|---|---|---|
_dz | Divide x,y components by z | source register_dz | 1.4 |
_db | source register_db | 1.4 | |
_dw | Divide x,y components by w | source register_dw | 1.4 |
_da | source register_da | 1.4 |
Register
Source register. For more about register types, see Registers.
Remarks
The _dz or _db modifier does the following:
x' = x/z ( x' = 1.0 if z == 0) y' = y/z ( y' = 1.0 if z == 0) z' is undefined w' is undefined
The _dw or _da modifier does the following:
x' = x/w ( x' = 1.0 if w == 0) y' = y/w ( y' = 1.0 if w == 0) z' is undefined w' is undefined
Note For pixel shader version 1.4, the D3DTTFF_PROJECTED flag under D3DTSS_TEXTURETRANSFORMFLAGS is ignored because a projective divide is accomplished by the source register modifiers listed previously.
Source Register Selectors for texld and texcrd
Selectors replicate the contents of one channel into other channels. Replicating the contents of a channel to one or more other channels is commonly referred to as "swizzling."
Source register selectors | Description | Syntax | Version |
---|---|---|---|
xyz | Maps x,y,z data to channels x,y,z,z | source register.xyz | 1.4 |
rgb | source register.rgb | 1.4 | |
xyw | Maps x,y,w data to channels x,y,w,w | source register.xyw | 1.4 |
rga | source register.rga | 1.4 |
Register
Source register. For more about register types, see Registers.
Remarks
The texld and texcrd instructions never read more than the first three components. So, these selectors provide the option of taking the third component from either the third or the fourth component of the source register.
Destination Register Write Masks for texld and texcrd
Write masks control which channels (red, green, blue, alpha) are updated in the destination register.
Destination register write masks | Description | Syntax | Used by | Version |
---|---|---|---|---|
xyzw | Updates the x,y,z,w channels | destination register.xyzw | texld only | 1.4 |
rgba | destination register.rgba | texld only | 1.4 | |
none | destination register | texld only | 1.4 | |
xyz | Updates the x,y,z channels | destination register.xyz | texcrd only | 1.4 |
rgb | destination register.rgb | texcrd only | 1.4 | |
xy | Updates the x,y channels | destination register.xy | texcrd only | 1.4 |
rg | destination register.rg | texcrd only | 1.4 |
Register
Destination register. For more about register types, see Registers.