Instructions - vs_2_0

This section contains reference information for the vertex shader version 2_0 instructions.

There are several types of vertex 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 - Non-arithmetic instructions. Every shader must have a version instruction and it must be the first instruction.
  • Arithmetic - These instructions provide the mathematical operations in a shader.
  • Flow control - These instructions add flow control capabilities such as loop...endloop, if...else...endif - vs, and subroutine calls.
  • New - These instructions are new to this version.

Instruction Set

NameDescriptionInstruction slotsSetupArithmeticFlow controlNew
abs - vs Absolute value1xx
add - vs Add two vectors1x
call - vs Call a subroutine2xx
callnz bool - vs Call a subroutine if a Boolean register is not zero3xx
crs - vs Cross product2xx
dcl_usage input (sm1, sm2, sm3 - vs asm) Declare input vertex registers (see Registers - vs_2_0)0x
def - vs Define constants0x
defb - vs Define a Boolean constant0xx
defi - vs Define an integer constant0xx
dp3 - vs Three-component dot product1x
dp4 - vs Four-component dot product1x
dst - vs Calculate the distance vector1x
else - vs Begin an else - vs block1xx
endif - vs End an if bool - vs...else - vs block1xx
endloop - vs End of a loop - vs block2xx
endrep - vs End of a repeat block2xx
exp - vs Full precision 2x1x
exp - vs Partial precision 2x1x
frc - vs Fractional component1x
if bool - vs Begin an if bool - vs block (using a Boolean condition)3xx
label - vs Label0xx
lit - vs Partial lighting calculation3x
log - vs Full precision log₂(x)1x
logp - vs Partial precision log₂(x)1x
loop - vs Loop3xx
lrp - vs Linear interpolation2xx
m3x2 - vs 3x2 multiply2x
m3x3 - vs 3x3 multiply3x
m3x4 - vs 3x4 multiply4x
m4x3 - vs 4x3 multiply3x
m4x4 - vs 4x4 multiply4x
mad - vs Multiply and add1x
max - vs Maximum1x
min - vs Minimum1x
mov - vs Move1x
mova - vs Move data from a floating-point register to the address register (a0)1xx
mul - vs Multiply1x
nop - vs No operation1x
nrm - vs Normalize a 4D vector3xx
pow - vs xy3xx
rcp - vs Reciprocal1x
rep - vs Repeat3xx
ret - vs End of either a subroutine or main1xx
rsq - vs Reciprocal square root1x
sge - vs Greater than or equal compare1x
sgn - vs Sign3xx
sincos - vs Sine and cosine8xx
slt - vs Less than compare1x
sub - vs Subtract1x
vs Version0x


Related topics

Vertex Shader Instructions