Single page Print

Pixel shaders
A pixel shader is a set of microcode that, when downloaded to the graphics processor, execute on-chip and operates on pixels and texels. R200 ushers in pixel shader 'version 1.4'. It makes possible the mixing of a greater number of textures (six to be exact) than pixel shader 'version 1.1' of the GeForce3. More important than a numerical advantage, 'version 1.4' unifies the instruction set and introduces the concept of 'phase'.

The pixel shader executes in two phases. The first phase involves texture sampling and texture address operations. As an improvement over GeForce3 pixel shader, the texture sampling instructions have been expanded to encompass the entire spectrum of color operations. In addition to simplifying the programming model, unifying the texture and color operations makes it possible to reuse the same circuitry for both operations.

The second phase permits dependent texture reads as well as color operations. The ability to sample a texture value, modify that value in the address shader, and use the modified value as an address to sample a different texture allows pixel shaders to perform what are known as dependent texture reads. GeForce3, by contrast, only supports dependent texture read as a special case in cubic environment bump mapping.

Figure 6 is a flow diagram of a pixel shader in action. The diagram illustrates the concepts of phase and dependent sampling.


Figure 6: A flow diagram of a pixel shader that produces variable specular

Besides enabling the expression of additional material properties hitherto not possible with GeForce3's pixel shader, the greater range and precision of the R200 pixel shader improves existing effects, as well. Here we have an example of Pixel Shader Version 1.0 diffuse bump mapping. We can see that the greater range and precision of the R200 pixel color unit produces greater light saturation as well as well-defined bumps (Figure 7).


Figure 7: Diffuse bump mapping - R200 (top), GeForce3 (bottom)