Real-Time Shader Programming

The order in which instructions appear in a pixel shader is determined by the shader version. There are five different types of instructions that can be in a pixel shader. The very first instruction must be the shader version declaration, followed by the constant definitions. The phase instruction is found only in PS 1.4 shaders. None of these instructions count toward the total number of instructions; only the two remaining types, the texture addressing and the arithmetic instructions, count toward the total instruction count.
| | Significant changes were made to pixel shaders between versions 1.3 and 1.4 due to the addition of the phase instruction in PS 1.4. The phase instruction was removed for PS 2.0 shaders and arithmetic and texture addressing instructions could be mixed. |
| Note | Destination registers are independent of the read port count restrictions. |
Texture addressing instructions must precede the color-blending instructions. There can be a maximum of eight arithmetic instructions and a maximum of four texture instructions. For PS 1.0, there's an additional limitation in that the total number of instructions is limited to eight (Figure 8.1).
The syntax for the texture address computation operation is included within the shader program itself in the form of texture declarations. These control how address perturbation operations are applied to the color values sampled from the textures during their preloading...