Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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 slots - Number of instruction slots used by each instruction.
  • Setup - A pixel shader must have a version instruction and it must be the first instruction.
  • Arithmetic - These instructions provide the mathematical operations in a shader.
  • Texture - These instructions are used to load and sample texture data, and to modify texture coordinates.
  • Flow control - These instructions provide static and dynamic flow control to the execution of instructions.
  • New - These instructions are new to this version.

Instruction Set

NameDescriptionInstruction slotsSetupArithmeticTextureFlow controlNew
abs - ps Absolute value1x
add - ps Add two vectors1x
break - ps Break out of a rep...endrep block1xx
break_comp - ps Conditionally break out of a rep...endrep block, with a comparison3xx
breakp - ps Break out of a rep...endrep block, based on a predicate3xx
call - ps Call a subroutine2xx
callnz bool - ps Call a subroutine if a boolean register is not zero3xx
callnz pred - ps Call a subroutine if a predicate register is not zero3xx
cmp - ps Compare source to 01x
crs - ps Cross product2x
dcl_samplerType (sm2, sm3 - ps asm) Declare the texture dimension for a sampler0x
dcl - (sm2, sm3 - ps asm) Declare the association between vertex shader output registers and pixel shader input registers.0x
def - ps Define constants0x
defb - ps Define a Boolean constant0xx
defi - ps Define an integer constant0xx
dp2add - ps 2D dot product and add2x
dp3 - ps 3D dot product1x
dp4 - ps 4D dot product1x
dsx - ps Rate of change in the x-direction2xx
dsy - ps Rate of change in the y direction2xx
else - ps Begin an else block1xx
endif - ps End an if...else block1xx
endrep - ps End of a repeat block2xx
exp - ps Full precision 2x1x
frc - ps Fractional component1x
if bool - ps Begin an if block3xx
if_comp - ps Begin an if block with a comparison3xx
if pred - ps Begin an if block with predication3xx
label - ps Label0xx
log - ps Full precision log₂(x)1x
lrp - ps Linear interpolate2x
m3x2 - ps 3x2 multiply2x
m3x3 - ps 3x3 multiply3x
m3x4 - ps 3x4 multiply4x
m4x3 - ps 4x3 multiply3x
m4x4 - ps 4x4 multiply4x
mad - ps Multiply and add1x
max - ps Maximum1x
min - ps Minimum1x
mov - ps Move1x
mul - ps Multiply1x
nop - ps No operation1x
nrm - ps Normalize3x
pow - ps xy3x
ps Version0x
rcp - ps Reciprocal1x
rep - ps Repeat3xx
ret - ps End of a subroutine1xx
rsq - ps Reciprocal square root1x
setp_comp Set the predicate register1xx
sincos - ps Sine and cosine8x
sub - ps Subtract1x
texkill - ps Kill pixel renderSee note 1x
texld - ps_2_0 and up Sample a textureSee note 2x
texldb - ps Texture sampling with level-of-detail bias from w-componentSee note 3x
texldd - ps Texture sampling with user-provided gradients3xx
texldp - ps Texture sampling with projective divide by w-componentSee note 4x

 

Notes:

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

Related topics

Pixel Shader Instructions

 

 

Show:
© 2016 Microsoft