Programming Guide for HLSL
At a very high level, data enters the graphics pipeline as a stream of primitives and is processed by up to as many as three shader stages:
- A vertex shader performs per-vertex processing such as transformations, skinning, vertex displacement, and calculating per-vertex material attributes. Tessellation of higher-order primitives should be done before the vertex shader executes. As a minimum, a vertex shader must output vertex position in homogeneous clip space. Optionally, the vertex shader can output texture coordinates, vertex color, vertex lighting, fog factors, and so on.
- A geometry shader performs per-primitive processing such as material selection and silhouette-edge detection, and can generate new primitives for point sprite expansion, fin generation, shadow volume extrusion, and single pass rendering to multiple faces of a cube texture.
- A pixel shader performs per-pixel processing such as texture blending, lighting model computation, and per-pixel normal and/or environmental mapping. Pixel shaders work in concert with vertex shaders; the output of a vertex shader provides the inputs for a pixel shader. In Direct3D 9 some pixel operations (such as fog blending, stencil operations, and render-target blending) occur after the pixel shader is finished.
These stages are completely programmable using the High Level Shading Language (HLSL). HLSL shaders can be compiled at author-time or at runtime, and set at runtime into the appropriate pipeline stage. Direct3D 9 shaders can be designed using shader model 1, shader model 2 and shader model 3; Direct3D 10 shaders can only be designed on shader model 4. Direct3D 11 shaders can be designed on shader model 5.
Using shader linking
Shader linking is new for Windows 8.1.
- Writing HLSL Shaders in Direct3D 9
- Using Shaders in Direct3D 9
- Using Shaders in Direct3D 10
- Optimizing HLSL Shaders
- Debugging Shaders in Visual Studio
- Compiling Shaders
- Specifying Compiler Targets
- Unpacking and Packing DXGI_FORMAT for In-Place Image Editing
- Using HLSL minimum precision, which is new for Windows 8
User clip planes on feature level 9 hardware
The clipplanes attribute is new for Windows 8.
- HLSL Shader Model 5 Features for Direct3D 11