# ps_1_1, ps_1_2, ps_1_3, ps_1_4 Instructions

This section contains reference information for the pixel shader version 1_X instructions.

There are several types of pixel shader instructions, as shown in the following table.

## Instruction Set

Version | Instruction slots | 1_1 | 1_2 | 1_3 | 1_4 | |
---|---|---|---|---|---|---|

ps | Version number | 0 | x | x | x | x |

Constant instructions | 1_1 | 1_2 | 1_3 | 1_4 | ||

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

Phase instructions | 1_1 | 1_2 | 1_3 | 1_4 | ||

phase - ps | Transition between phase 1 and phase 2 | 0 | x | |||

Arithmetic instructions | 1_1 | 1_2 | 1_3 | 1_4 | ||

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

bem - ps | Apply a fake bump environment-map transform | 2 | x | |||

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

cnd - ps | Compare source to 0.5 | 1 | x | x | x | x |

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

dp4 - ps | Four-component dot product | 11 | x | x | x | |

lrp - ps | Linear interpolate | 1 | x | x | x | x |

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

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

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

nop - ps | No operation | 0 | x | x | x | x |

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

Texture instructions | 1_1 | 1_2 | 1_3 | 1_4 | ||

tex - ps | Sample a texture | 1 | x | x | x | |

texbem - ps | Apply a fake bump environment-map transform | 1 | x | x | x | |

texbeml - ps | Apply a fake bump environment-map transform with luminance correction | 1+12 | x | x | x | |

texcoord - ps | Interpret texture coordinate data as color data | 1 | x | x | x | |

texcrd - ps | Copy texture coordinate data as color data | 1 | x | |||

texdepth - ps | Calculate depth values | 1 | x | |||

texdp3 - ps | Three-component dot product between texture data and the texture coordinates | 1 | x | x | ||

texdp3tex - ps | Three-component dot product and 1D texture lookup | 1 | x | x | ||

texkill - ps | Cancels rendering of pixels based on a comparison | 1 | x | x | x | x |

texld - ps_1_4 | Sample a texture | 1 | x | |||

texm3x2depth - ps | Calculate per-pixel depth values | 1 | x | |||

texm3x2pad - ps | First row matrix multiply of a two-row matrix multiply | 1 | x | x | x | |

texm3x2tex - ps | Final row matrix multiply of a two-row matrix multiply | 1 | x | x | x | |

texm3x3 - ps | 3x3 matrix multiply | 1 | x | x | ||

texm3x3pad - ps | First or second row multiply of a three-row matrix multiply | 1 | x | x | x | |

texm3x3spec - ps | Final row multiply of a three-row matrix multiply | 1 | x | x | x | |

texm3x3tex - ps | Texture look up using a 3x3 matrix multiply | 1 | x | x | x | |

texm3x3vspec - ps | Texture look up using a 3x3 matrix multiply, with non-constant eye-ray vector | 1 | x | x | x | |

texreg2ar - ps | Sample a texture using the alpha and red components | 1 | x | x | x | |

texreg2gb - ps | Sample a texture using the green and blue components | 1 | x | x | x | |

texreg2rgb - ps | Sample a texture using the red, green and blue components | 1 | x | x |

- 1 slot in ps_1_4; 2 slots in ps_1_2 and ps_1_3
- 1 + 1 = 1 arithmetic instruction + 1 texture instruction

## Community Additions

ADD
Show: