Real-Time Shader Programming

INSTRUCTION ORDER AND INSTRUCTION COUNTS

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.

DirectX 9 update

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.

For Pixel Shaders 1.0 Through 1.3

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).


Figure 8.1: Constant, texture addressing, and arithmetic instructions for pixel shaders 1.0 through 1.3.

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...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Microprocessor Chips (MPU)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.