?/TD>
Microsoft DirectX 9.0

Instructions - ps_2_x


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 slotsSetupArithmeticMacro-opsTextureFlow ControlNew
absAbsolute value1x
addAdd two vectors1x
breakBreak out of a loop...endloop or rep...endrep block1xx
break_compConditionally break out of a loop...endloop or rep...endrep block, with a comparison3xx
break predBreak out of a loop...endloop or rep...endrep block, based on a predicate3xx
callCall a subroutine2xx
callnzCall 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
dclMap a vertex element type to an input vertex register0x
dcl_textureTypeDeclare the texture dimension for a sampler0x
defDefine constants0x
dp2add2-D dot product and add1x
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 2x1xx
frcFractional component1x
ifBegin 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
pow2x3x
psVersion0x
rcpReciprocal1x
repRepeat3xx
retEnd of a subroutine1xx
rsqReciprocal square root1x
setpSet the predicate register1xx
sincosSine and cosine8x
subSubtract1x
texkillKill pixel render2(tex)x
texldSample a texture1 + 3CUBEx
texldbTexture sampling with level of detail (LOD) bias from w-component6(tex)x
texlddTexture sampling with user-provided gradients3xx
texldpTexture sampling with projective divide by w-component3 + 1CUBEx

Where:

Instruction Count and Nesting Depth

Shaders have restrictions for maximum instuction counts, as well as nesting depths for static and dynamic flow control instructions.

Overall Instruction Count

Total Instruction slots: 512 maximum

The maximum number of instructions run is indicated by the MaxPShaderInstructionsExecuted cap in D3DCAPS9.

This can be set to the #define D3DINFINITEINSTRUCTIONS, indicating that the actual number of instructions run is unlimited.

The total number of instructions run should be clamped to the device driver D3DRS_MAXPIXELSHADERINST. The legal values for this renderstate are numbers that are powers of 2; if any other integer is set, the next nearest pow2 number is assumed. This renderstate defaults to D3DINFINITEINSTRUCTIONS.

Dynamic Flow Control Nesting Depth

D3DCAPS9.D3DPSHADERCAPS2_0.DynamicFlowControlDepth represents the nesting depth of static flow control instructions: if, break, and break_comp. The value is equal to the nesting depth of the if_comp block. The range of values for this cap is 0 to 24. If this cap is zero, the device does not support dynamic flow control instructions.

Static Flow Control Nesting Depth

D3DCAPS9.D3DPSHADERCAPS2_0.StaticFlowControlDepth represents the nesting depth of static flow control instructions: loop/rep and call/callnz. The range of values for this cap is 1 to 4. Note that loop/rep count toward the same nesting depth, and call/callnz count toward the same nesting depth. If this cap is zero, the device does not support static flow control instructions.



© 2002 Microsoft Corporation. All rights reserved.