ps_2_x Instructions
Microsoft DirectX 9.0 SDK Update (October 2004)

ps_2_x Instructions


This section contains reference information for the pixel shader version 2_x instructions.

There are several types of pixel shader instructions, as shown in the table. Columns to the right mean the following:

Instruction Set

NameDescriptionInstruction slotsSetupArithmeticTextureFlow controlNew
absAbsolute value1x
addAdd two vectors1x
breakBreak out of a rep...endrep block1xx
break_compConditionally break out of a rep...endrep block, with a comparison3xx
breakpBreak out of a rep...endrep block, based on a predicate3xx
callCall a subroutine2xx
callnz boolCall a subroutine if a boolean register is not zero3xx
callnz predCall a subroutine if a predicate register is not zero3xx
cmpCompare source to 01x
crsCross product2x
dcl_samplerTypeDeclare the texture dimension for a sampler0x
dclDeclare the association between vertex shader output registers and pixel shader input registers.0x
defDefine constants0x
defbDefine a Boolean constant0xx
defiDefine an integer constant0xx
dp2add2-D dot product and add2x
dp33-D dot product1x
dp44-D dot product1x
dsxRate of change in the x-direction2xx
dsyRate of change in the y direction2xx
elseBegin an else block1xx
endifEnd an if...else block1xx
endrepEnd of a repeat block2xx
expFull precision 2x1x
frcFractional component1x
if boolBegin an if block3xx
if_compBegin an if block with a comparison3xx
if predBegin an if block with predication3xx
labelLabel0xx
logFull precision log2(x)1x
lrpLinear interpolate2x
m3x23x2 multiply2x
m3x33x3 multiply3x
m3x43x4 multiply4x
m4x34x3 multiply3x
m4x44x4 multiply4x
madMultiply and add1x
maxMaximum1x
minMinimum1x
movMove1x
mulMultiply1x
nopNo operation1x
nrmNormalize3x
powxy3x
psVersion0x
rcpReciprocal1x
repRepeat3xx
retEnd of a subroutine1xx
rsqReciprocal square root1x
setp_compSet the predicate register1xx
sincosSine and cosine8x
subSubtract1x
texkillKill pixel renderSee note 1x
texldSample a textureSee note 2x
texldbTexture sampling with level of detail (LOD) bias from w-componentSee note 3x
texlddTexture sampling with user-provided gradients3xx
texldpTexture sampling with projective divide by w-componentSee note 4x

Notes:

  1. If D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT is set, slots = 2; otherwise slots = 1.
  2. If D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT is set and the texture is a cube map, slots = 4; otherwise slot = 1.
  3. If D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT is set, slots = 6; otherwise slots = 1.
  4. If D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT is not set, slots = 1; otherwise:
    • if D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT is set and the texture is a cube map, slots = 4.
    • if D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT is set and the texture is not a cube map, slots = 3.


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.