Instructions - vs_2_x
This section contains reference information for the vertex shader version 2_x 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 - vs...endloop - vs, if bool - vs...else...endif, and subroutine calls.
- New - These instructions are new to this version.
Instruction Set
Name | Description | Instruction slots | Setup | Arithmetic | Flow control | New |
---|---|---|---|---|---|---|
abs - vs | Absolute value | 1 | x | |||
add - vs | Add two vectors | 1 | x | |||
break - vs | Break out of a loop - vs...endloop - vs or rep...endrep block | 1 | x | x | ||
break_comp - vs | Conditionally break out of a loop - vs...endloop - vs or rep...endrep block, with a comparison | 3 | x | x | ||
breakp - vs | Break out of a loop - vs...endloop - vs or rep...endrep block, based on a predicate | 3 | x | x | ||
call - vs | Call a subroutine | 2 | x | |||
callnz bool - vs | Call a subroutine if a Boolean register is not zero | 3 | x | |||
callnz pred - vs | Call a subroutine if a predicate register is not zero | 3 | x | x | ||
crs - vs | Cross product | 2 | x | |||
dcl_usage input (sm1, sm2, sm3 - vs asm) | Declare input vertex registers (see Registers - vs_2_x) | 0 | x | |||
def - vs | Define constants | 0 | x | |||
defb - vs | Define a Boolean constant | 0 | x | |||
defi - vs | Define an integer constant | 0 | x | |||
dp3 - vs | Three-component dot product | 1 | x | |||
dp4 - vs | Four-component dot product | 1 | x | |||
dst - vs | Calculate the distance vector | 1 | x | |||
else - vs | Begin an else - vs block | 1 | x | |||
endif - vs | End an if bool - vs...else - vs block | 1 | x | |||
endloop - vs | End of a loop - vs block | 2 | x | |||
endrep - vs | End of a repeat block | 2 | x | |||
exp - vs | Full precision 2x | 1 | x | |||
expp - vs | Partial precision 2x | 1 | x | |||
frc - vs | Fractional component | 1 | x | |||
if bool - vs | Begin an if bool - vs block (using a Boolean condition) | 3 | x | |||
if_comp - vs | Begin an if bool - vs block, with a comparison | 3 | x | x | ||
if pred - vs | Begin an if bool - vs block with a predicate condition | 3 | x | x | ||
label - vs | Label | 0 | x | |||
lit - vs | Partial lighting calculation | 3 | x | |||
log - vs | Full precision log₂(x) | 1 | x | |||
logp - vs | Partial precision log₂(x) | 1 | x | |||
loop - vs | Loop | 3 | x | |||
lrp - vs | Linear interpolation | 2 | x | |||
m3x2 - vs | 3x2 multiply | 2 | x | |||
m3x3 - vs | 3x3 multiply | 3 | x | |||
m3x4 - vs | 3x4 multiply | 4 | x | |||
m4x3 - vs | 4x3 multiply | 3 | x | |||
m4x4 - vs | 4x4 multiply | 4 | x | |||
mad - vs | Multiply and add | 1 | x | |||
max - vs | Maximum | 1 | x | |||
min - vs | Minimum | 1 | x | |||
mov - vs | Move | 1 | x | |||
mova - vs | Move data from a floating-point register to the address register (a0) | 1 | x | |||
mul - vs | Multiply | 1 | x | |||
nop - vs | No operation | 1 | x | |||
nrm - vs | Normalize a 4D vector | 3 | x | |||
pow - vs | xy | 3 | x | |||
rcp - vs | Reciprocal | 1 | x | |||
rep - vs | Repeat | 3 | x | |||
ret - vs | End of either a subroutine or main | 1 | x | |||
rsq - vs | Reciprocal square root | 1 | x | |||
setp_comp - vs | Set the predicate register | 1 | x | x | ||
sge - vs | Greater than or equal compare | 1 | x | |||
sgn - vs | Sign | 3 | x | |||
sincos - vs | Sine and cosine | 8 | x | |||
slt - vs | Less than compare | 1 | x | |||
sub - vs | Subtract | 1 | x | |||
vs | Version | 0 | x |
Related topics