The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

# Instructions - vs_3_0

This section contains reference information for the vertex shader version 3_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.
- Texture - These instructions support texture address lookup.
- Flow control - These instructions add flow control such as loops, repeats, and if bool - vs...else...endif comparisons.
- New - These instructions are new to this version.

## Instruction Set

Name | Description | Instruction slots | Setup | Arithmetic | Texture | 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 | ||||

break_comp - vs | Conditionally break out of a loop - vs...endloop - vs or rep...endrep block, with a comparison | 3 | x | ||||

breakp - vs | Break out of a loop - vs...endloop - vs or rep...endrep block, based on a predicate | 3 | 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 | ||||

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

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

dcl_samplerType (sm3 - vs asm) | Declare the texture dimension for a sampler | 0 | x | x | |||

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

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

defi - vs | Declare an integer constant | 0 | x | ||||

dp3 - vs | Three-component dot product | 1 | x | ||||

dp4 - vs | Four-component dot product | 1 | x | ||||

dst - vs | Distance | 1 | x | ||||

else - vs | Begin an else block | 1 | x | ||||

endif - vs | End an if bool - vs...else 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 | ||||

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

if_comp - vs | Begin an if bool - vs block, with a comparison | 3 | x | ||||

if pred - vs | Begin an if bool - vs block with a predicate condition | 3 | x | ||||

label - vs | Label | 0 | x | ||||

lit - vs | Calculate lighting | 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 an integer register | 1 | x | ||||

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

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

nrm - vs | Normalize | 3 | x | ||||

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

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

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

ret - vs | End of a subroutine | 1 | x | ||||

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

setp_comp - vs | Set the predicate register | 1 | 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 | ||||

texldl - vs | Texture load with user-adjustable level-of-detail | See note 1 | x | x | |||

vs | Version | 0 | x |

Notes:

- if the texture is a cube map, slots = 5; otherwise slots = 2

## Related topics

Show: