# 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

Name | Description | Instruction slots | Setup | Arithmetic | Flow control | New |
---|---|---|---|---|---|---|

abs - vs | Absolute value | 1 | x | x | ||

add - vs | Add two vectors | 1 | x | |||

call - vs | Call a subroutine | 2 | x | x | ||

callnz bool - vs | Call a subroutine if a Boolean register is not zero | 3 | x | x | ||

crs - vs | Cross product | 2 | x | x | ||

dcl_usage input (sm1, sm2, sm3 - vs asm) | Declare input vertex registers (see Registers - vs_2_0) | 0 | x | |||

def - vs | Define constants | 0 | x | |||

defb - vs | Define a Boolean constant | 0 | x | x | ||

defi - vs | Define an integer constant | 0 | x | 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 | x | ||

endif - vs | End an if bool - vs...else - vs block | 1 | x | x | ||

endloop - vs | End of a loop - vs block | 2 | x | x | ||

endrep - vs | End of a repeat block | 2 | x | x | ||

exp - vs | Full precision 2x | 1 | x | |||

exp - 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 | x | ||

label - vs | Label | 0 | x | 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 | x | ||

lrp - vs | Linear interpolation | 2 | x | 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 | x | ||

mul - vs | Multiply | 1 | x | |||

nop - vs | No operation | 1 | x | |||

nrm - vs | Normalize a 4D vector | 3 | x | x | ||

pow - vs | xy | 3 | x | x | ||

rcp - vs | Reciprocal | 1 | x | |||

rep - vs | Repeat | 3 | x | x | ||

ret - vs | End of either a subroutine or main | 1 | x | x | ||

rsq - vs | Reciprocal square root | 1 | x | |||

sge - vs | Greater than or equal compare | 1 | x | |||

sgn - vs | Sign | 3 | x | x | ||

sincos - vs | Sine and cosine | 8 | x | x | ||

slt - vs | Less than compare | 1 | x | |||

sub - vs | Subtract | 1 | x | |||

vs | Version | 0 | x |

## Related topics

Show: