Vertex Shaders

DirectX8

Microsoft DirectX 8.1 (shader versions 1.0, 1.1)

Vertex Shaders

Previous to Microsoft® DirectX® 8.n, Microsoft® Direct3D® operated a fixed function pipeline for converting three-dimensional (3-D) geometry to rendered screen pixels. The user sets attributes of the pipeline that control how Direct3D transforms, lights, and renders pixels. The fixed function vertex format is declared at compile time and determines the input vertex format. Once defined, the user has little control over pipeline changes during runtime.

Programmable shaders add a new dimension to the graphics pipeline by allowing the transform, lighting, and rendering functionality to be modified at runtime. A shader is declared at runtime but, once done, the user is free to change which shader is active as well as to control the shader data dynamically using streaming data. This gives the user a new level of dynamic flexibility over the way that pixels are rendered.

A vertex shader file contains vertex shader instructions. Vertex shaders can control vertex color and how textures are applied to vertices. Lighting can be added through the use of vertex shader instructions. The shader instruction file contains ASCII text so it is readable and in some ways looks similar to assembly language. A vertex shader is invoked after any DrawPrimitive or DrawIndexedPrimitive call. Shaders can be dynamically switched using SetVertexShader to specify a new shader file, or by changing the instructions in the ASCII text shader file using the streaming data inputs. The Vertex Shader Assembler Reference has a complete listing of shader instructions.

For additional information, see the following sections.