# ps_2_0 Instructions

### In this article

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

There are several types of pixel 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 - A pixel 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 are used to load and sample texture data, and to modify texture coordinates.
- New - These instructions are new to this version.

## Instruction Set

Name | Description | Instruction slots | Setup | Arithmetic | Texture | New |
---|---|---|---|---|---|---|

abs - ps | Absolute value | 1 | x | x | ||

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

cmp - ps | Compare source to 0 | 1 | x | |||

crs - ps | Cross product | 2 | x | x | ||

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

dcl - (sm2, sm3 - ps asm) | Declare the association between vertex shader output registers and pixel shader input registers. | 0 | x | x | ||

def - ps | Define constants | 0 | x | |||

dp2add - ps | 2D dot product and add | 2 | x | x | ||

dp3 - ps | 3D dot product | 1 | x | |||

dp4 - ps | 4D dot product | 1 | x | |||

exp - ps | Full precision 2^{x} |
1 | x | x | ||

frc - ps | Fractional component | 1 | x | x | ||

log - ps | Full precision log₂(x) | 1 | x | x | ||

lrp - ps | Linear interpolate | 2 | x | |||

m3x2 - ps | 3x2 multiply | 2 | x | x | ||

m3x3 - ps | 3x3 multiply | 3 | x | x | ||

m3x4 - ps | 3x4 multiply | 4 | x | x | ||

m4x3 - ps | 4x3 multiply | 3 | x | x | ||

m4x4 - ps | 4x4 multiply | 4 | x | x | ||

mad - ps | Multiply and add | 1 | x | |||

max - ps | Maximum | 1 | x | x | ||

min - ps | Minimum | 1 | x | x | ||

mov - ps | Move | 1 | x | |||

mul - ps | Multiply | 1 | x | |||

nop - ps | No operation | 1 | x | |||

nrm - ps | Normalize | 3 | x | x | ||

pow - ps | x^{y} |
3 | x | x | ||

ps | Version | 0 | x | |||

rcp - ps | Reciprocal | 1 | x | x | ||

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

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

sub - ps | Subtract | 1 | x | |||

texkill - ps | Kill pixel render | 1 | x | |||

texld - ps_2_0 and up | Sample a texture | 1 | x | x | ||

texldb - ps | Texture sampling with level-of-detail bias from w-component | 1 | x | x | ||

texldp - ps | Texture sampling with projective divide by w-component | 1 | x | x |

## Related topics