Programming guide for HLSL

Data enters the graphics pipeline as a stream of primitives and is processed by the shader stages. The actual shader stages depend on the version of Direct3D, but certainly include the vertex, pixel and geometry stages. Other stages include the hull and domain shaders for tessellation, and the compute shader. 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. Direct3D 11.3 and Direct3D 12 can be designed on shader model 5.1, and Direct3D 12 can also be designed on shader model 6.

In this section

Topic Description
Using shader linking We show how to create precompiled HLSL functions, package them into libraries, and link them into full shaders at run-time.
Writing HLSL Shaders in Direct3D 9
Using Shaders in Direct3D 9
Using Shaders in Direct3D 10
Optimizing HLSL Shaders
Debugging Shaders in Visual Studio The latest tool for debugging shaders now ships as a feature in Microsoft Visual Studio, called Visual Studio Graphics Debugger.
Compiling Shaders Let's now look at various ways to compile your shader code and conventions for file extensions for shader code.
Specifying Compiler Targets Here we list the targets for various profiles that the D3DCompile* functions and the HLSL compiler support.
Unpacking and Packing DXGI_FORMAT for In-Place Image Editing
Using HLSL minimum precision Starting with Windows 8, graphics drivers can implement minimum precision HLSL scalar data types by using any precision greater than or equal to their specified bit precision.
HLSL Shader Model 5
HLSL Shader Model 5.1 This section describes the features of Shader Model 5.1 as they apply in practice to D3D12 and D3D11.3. All DirectX 12 hardware supports Shader Model 5.1.
HLSL Shader Model 6.0 Describes the wave operation intrinsics added to HLSL Shader Model 6.0.
HLSL Shader Model 6.4 Describes the machine learning intrinsics added to HLSL Shader Model 6.4.