Shader Model 3.0
Before we discuss the changes in the 3.0 pixel and vertex shader models, we’ll start with the traits they both share in common.
Clear Sailing demo
Check out the NVIDIA logo on the front flag
While shader model 2.0’s shaders have the potential to bring a new level of photorealism to the PC, the 2.0 shader model was limited in the length of shader instructions: shader model 2.0 was officially limited to a pixel shader length of 96 instructions. In shader model 3.0, this figure is increased to 32,768 instructions. This increase allows developers to implement more complex shader programs. If you recall NVIDIA’s NV3x architecture, one of the primary highlights NVIDIA touted was instruction limits beyond the shader 2.0 model on both pixel and vertex shaders, NVIDIA referred to this as “2.0+” shaders. Keep in mind however that this doesn’t mean NV3x series is shader model 3.0 compliant, as there are other new features that have been introduced.
For the GeForce 6 series (and thus, GeForce 6800 Ultra) NVIDIA boasts their GPUs support vertex and pixel shader programs of an infinite length, although obviously a cutoff point has to be established in order to ensure optimal performance, as longer programs take more time to finish than shorter programs.
Besides providing maximums, shader model 3.0 also increases the minimum length of shader programs as well. A minimum of 512 instructions is stipulated for both pixel and vertex shader 3.0.
Dynamic looping/branching (Flow Control)
One feature that has been implemented in shader model 3.0 that is designed to make writing shaders easier for developers is dynamic branching/looping (also referred to as dynamic flow control). With dynamic branching, developers can add loops to their shader
NVIDIA mentions an example involving multiple light sources. In previous shader models, the developer would have to write a shader for each light. Dynamic branching makes it possible for the developer to write one shader which loops through a certain number of vertex lights and exits once all the lights have been processed. This will help to reduce shader count complexity. Another potential advantage to branching is reducing the variety of shaders used (i.e. many different shaders versus one).
Besides eased development, shader model 3.0 also presents potential performance improvements. For example, developers can use dynamic branching to skip unnecessary processing and help speed up the shader.
Branching, if not used carefully, can introduce slower performance. At the moment branching in graphics isn’t as powerful as in CPUs, which have considerably more resources for handling branching. Therefore, there’s another school of thought that believes branching, in its current form in shader model 3.0 is a little early.