Microsoft DirectX 9.0

Texture Register Modifiers

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 here.

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


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

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


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

© 2002 Microsoft Corporation. All rights reserved.