phase - ps
The phase instruction marks the transition between phase 1 and phase 2. If no phase instruction is present, the entire shader runs as if it is a phase 2 shader.
This instruction applies to version 1_4 only.
Syntax
phase
Remarks
Pixel shader versions | 1_1 | 1_2 | 1_3 | 1_4 | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
---|---|---|---|---|---|---|---|---|---|
phase | x |
Shader instructions that occur before the phase instruction are phase 1 instructions. All other instructions are phase 2 instructions. By having two phases for instructions, the maximum number of instructions per shader is increased.
The unfortunate side-effect of the phase transition is that the alpha component of temporary registers do not persist across the transition. In other words, the alpha component must be reinitialized after the phase instruction.
Example
This example shows how to group instructions as phase 1 or phase 2 instructions within a shader.
The phase instruction is also commonly called the phase marker because it marks the transition between phase 1 and 2 instructions. In a version 1_4 pixel shader, if the phase marker is not present, the shader is run as if it is running in phase 2. This is important because there are differences between phase 1 and 2 instructions and register availability. The differences are noted throughout the reference section.
ps_1_4
// Add phase 1 instructions here
phase
// Add phase 2 instructions here
Related topics