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.
- Macro-ops - These instructions combine arithmetic instructions to provide higher level functionality. The use of macro-ops is optional. It is preferable to use macro-ops, especially the matrix multiply instructions (m3x2, m3x3, m3x4, m4x3, m4x4), because they provide optimization opportunities to the underlying implementation.
- Flow control - These instructions add flow control such as loops, repeats, and if...else...endif comparisons.
- Texture - These instructions support texture address lookup.
- New - These instructions are new to this version.
Instruction Set
Name | Description | Instruction slots | Setup | Arithmetic | Macro-ops | Texture | Flow control | New |
---|
abs | Absolute value | 1 | | | x | | | |
add | Add two vectors | 1 | | x | | | | |
break | Break out of a loop...endloop or rep...endrep block | 1 | | | | | x | x |
break_comp | Conditionally break out of a loop...endloop or rep...endrep block, with a comparison | 3 | | | | | x | x |
break pred | Break out of a loop...endloop or rep...endrep block, based on a predicate | 3 | | | | | x | x |
call | Call a subroutine | 2 | | | | | x | x |
callnz pred | Call a subroutine if a predicate register is not zero | 3 | | | | | x | x |
crs | Cross product | 2 | | | x | | | |
dcl_usage | Declare input vertex registers (see Registers - vs_3_0) | 0 | x | | | | | |
dcl_textureType | Declare the texture dimension for a sampler | 0 | x | | | | | x |
def | Define constants | 0 | x | | | | | |
defb | Declare a Boolean constant | 0 | x | | | | | |
defi | Declare an integer constant | 0 | x | | | | | |
dp3 | Three-component dot product | 1 | | x | | | | |
dp4 | Three-component dot product | 1 | | x | | | | |
dst | Distance | 1 | | x | | | | |
else | Begin an else block | 1 | | | | | x | |
endif | End an if...else block | 1 | | | | | x | |
endloop | End of a loop block | 2 | | | | | x | |
endrep | End of a repeat block | 2 | | | | | x | |
exp | Full precision 2x | 1 | | | x | | | |
expp | Partial precision 2x | 1 | | | x | | | |
frc | Fractional component | 1 | | | x | | | |
if | Begin an if block (using a boolean condition) | 3 | | | | | x | x |
if comp | Begin an if block, with a comparison | 3 | | | | | x | x |
if pred | Begin an if block with a predicate condition | 3 | | | | | x | x |
label | Label | 0 | | | | | x | |
lit | Calculate lighting | 3 | | x | | | | |
log | Full precision log2(x) | 1 | | | x | | | |
logp | Partial precision log2(x) | 1 | | | x | | | |
loop | Loop | 3 | | | | | x | |
lrp | Linear interpolation | 2 | | | x | | | |
m3x2 | 3x2 multiply | 2 | | | x | | | |
m3x3 | 3x3 multiply | 3 | | | x | | | |
m3x4 | 3x4 multiply | 4 | | | x | | | |
m4x3 | 4x3 multiply | 3 | | | x | | | |
m4x4 | 4x4 multiply | 4 | | | x | | | |
mad | Multiply and add | 1 | | x | | | | |
max | Maximum | 1 | | x | | | | |
min | Minimum | 1 | | x | | | | |
mov | Move | 1 | | x | | | | |
mova | Move data from a floating point register to an integer register | 1 | | x | | | | |
mul | Multiply | 1 | | x | | | | |
nop | No operation | 1 | | x | | | | |
nrm | Normalize | 3 | | | x | | | |
pow | 2x | 3 | | | x | | | |
rcp | Reciprocal | 1 | | x | | | | |
rep | Repeat | 3 | | | | | x | |
ret | End of a subroutine | 1 | | | | | x | |
rsq | Reciprocal square root | 1 | | x | | | | |
setp | Set the predicate register | 1 | | | | | x | |
sge | Greater than or equal compare | 1 | | x | | | | |
sgn | Sign | 3 | | | x | | | |
sincos | Sine and cosine | 8 | | | x | | | |
slt | Less than compare | 1 | | x | | | | |
texldl | Texture load with user-adjustable level of detail (LOD) | 2+3CUBE | | | | x | | x |
vs | Version | 0 | x | | | | | |