ps_3_0 Instructions

This section contains reference information for the pixel shader version 3_0 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

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

 

Notes:

  1. If the texture is a cube map, slots = 4; otherwise slots = 1.
  2. If the texture is a cube map, slots = 5; otherwise slots = 2.
  3. If the texture is a cube map, slots = 4; otherwise slots = 3.

Pixel Shader Instructions