![]() |
![]() |
![]() |
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:
Name | Description | Instruction slots | Setup | Arithmetic | Texture | Flow control | New |
---|---|---|---|---|---|---|---|
abs | Absolute value | 1 | x | ||||
add | Add two vectors | 1 | x | ||||
break | Break out of a rep...endrep block | 1 | x | x | |||
break_comp | Conditionally break out of a rep...endrep block, with a comparison | 3 | x | x | |||
breakp | Break out of a rep...endrep block, based on a predicate | 3 | x | x | |||
call | Call a subroutine | 2 | x | x | |||
callnz bool | Call a subroutine if a boolean register is not zero | 3 | x | x | |||
callnz pred | Call a subroutine if a predicate register is not zero | 3 | x | x | |||
cmp | Compare source to 0 | 1 | x | ||||
crs | Cross product | 2 | x | ||||
dcl_samplerType | Declare the texture dimension for a sampler | 0 | x | ||||
dcl | Declare the association between vertex shader output registers and pixel shader input registers. | 0 | x | ||||
def | Define constants | 0 | x | ||||
defb | Define a Boolean constant | 0 | x | x | |||
defi | Define an integer constant | 0 | x | x | |||
dp2add | 2-D dot product and add | 2 | x | ||||
dp3 | 3-D dot product | 1 | x | ||||
dp4 | 4-D dot product | 1 | x | ||||
dsx | Rate of change in the x-direction | 2 | x | x | |||
dsy | Rate of change in the y direction | 2 | x | x | |||
else | Begin an else block | 1 | x | x | |||
endif | End an if...else block | 1 | x | x | |||
endrep | End of a repeat block | 2 | x | x | |||
exp | Full precision 2x | 1 | x | ||||
frc | Fractional component | 1 | x | ||||
if bool | Begin an if block | 3 | x | x | |||
if_comp | Begin an if block with a comparison | 3 | x | x | |||
if pred | Begin an if block with predication | 3 | x | x | |||
label | Label | 0 | x | x | |||
log | Full precision log2(x) | 1 | x | ||||
lrp | Linear interpolate | 2 | x | ||||
m3x2 | 3x2 multiply | 2 | x | ||||
m3x3 | 3x3 multiply | 3 | x | ||||
m3x4 | 3x4 multiply | 4 | x | ||||
m4x3 | 4x3 multiply | 3 | x | ||||
m4x4 | 4x4 multiply | 4 | x | ||||
mad | Multiply and add | 1 | x | ||||
max | Maximum | 1 | x | ||||
min | Minimum | 1 | x | ||||
mov | Move | 1 | x | ||||
mul | Multiply | 1 | x | ||||
nop | No operation | 1 | x | ||||
nrm | Normalize | 3 | x | ||||
pow | xy | 3 | x | ||||
ps | Version | 0 | x | ||||
rcp | Reciprocal | 1 | x | ||||
rep | Repeat | 3 | x | x | |||
ret | End of a subroutine | 1 | x | x | |||
rsq | Reciprocal square root | 1 | x | ||||
setp_comp | Set the predicate register | 1 | x | x | |||
sincos | Sine and cosine | 8 | x | ||||
sub | Subtract | 1 | x | ||||
texkill | Kill pixel render | See note 1 | x | ||||
texld | Sample a texture | See note 2 | x | ||||
texldb | Texture sampling with level of detail (LOD) bias from w-component | See note 3 | x | ||||
texldd | Texture sampling with user-provided gradients | 3 | x | x | |||
texldp | Texture sampling with projective divide by w-component | See note 4 | x |
Notes: