Other instructions
Direct3D 9 - Pixel Shader - Instructions - Other instructions
Last edited 2026-04-05
This section contains reference information for the pixel shader version ps_1_x, ps_2_x and ps_3_0 instructions.
There are several types of pixel shader instructions, as shown in the following table.
The "Instruction slots" column indicates how many instruction slots (Arithmetic or Texture) are required for a given instruction.
- If "Texture" or "Arithmetic" is not specified, the value is 0.
- This value may vary for a given instruction depending on whether the compiler optimizes the code automatically.
The meaning of colors in the Type column:
|
Color |
Description |
|
Green |
The instruction works. |
|
Blue |
This instruction works in some cases. (If a given Pixel Shader does not natively support a particular instruction, using only constant values instead of variables in that instruction will sometimes cause the compiler to calculate the result itself and use that result as a mathematical constant) |
|
Yellow |
The instruction has not been confirmed to work. (All information regarding the instructions for a given pixel shader must be verified to ensure it actually works) |
|
Orange |
This instruction is broken. (The instructions may be broken because the pixel shader does not function properly, for example, ps_3_0 or because of issues with the built-in compiler, OR for other reasons) |
|
Red |
The instruction does not work. |
Other instructions
|
Type |
Instruction |
Description |
Instruction slots |
ps_1_0 |
ps_1_1 |
ps_1_2 |
ps_1_3 |
ps_1_4 |
ps_2_0 |
ps_2_a |
ps_2_b |
ps_2_sw |
ps_3_0 |
ps_3_sw |
Note |
|
hlsl |
noise |
Generates a random value using the Perlin-noise algorithm. Perlin noise value within a range between -1 and 1. |
Unknown* |
No |
No |
No |
No |
No |
No |
No |
No |
Unknown |
No |
Unknown |
This function is not intended for modern pixel shaders; it only works on tx_1_0 and currently returns 0 or an error. |
|
hlsl |
clip |
Discards the current pixel if the specified value is less than zero. |
Texture: 1 |
No |
No |
No |
No |
Yes |
Yes |
Yes |
Yes |
Unknown |
Yes |
Unknown |
|
|
hlsl |
D3DCOLORtoUBYTE4 |
Converts a floating-point, 4-dimensional vector set by D3DCOLOR to UBYTE4, i.e., changes the order of components from RGBA to BGRA and scales the range from 0-1 to 0-255. |
Arithmetic: 1 |
No |
No |
No |
No |
No |
Yes |
Yes |
Yes |
Unknown |
Yes |
Unknown |
|
Created with the Personal Edition of HelpNDoc: Easy EPub and documentation editor