MSDN Documentation

Microsoft Developer Network - Windows Graphics

The DirectX Rendering Pipeline

The DirectX rendering pipeline is a series of programmable and fixed-function stages that transform 3D geometry into a 2D image on the screen. Understanding this pipeline is fundamental to developing efficient and visually appealing graphics applications using DirectX.

Conceptual DirectX Rendering Pipeline Diagram
A conceptual overview of the DirectX Rendering Pipeline.

Input Assembler (IA)

The Input Assembler is the first stage of the pipeline. Its primary responsibility is to take raw vertex data from system memory (or optimized GPU memory) and prepare it for the rest of the pipeline. This involves:

The IA stage determines how vertices are grouped into primitives, such as lists of triangles, triangle strips, or lines.

Vertex Shader (VS)

The Vertex Shader is a programmable stage that processes each vertex individually. Its main tasks are:

The output of the vertex shader is typically a transformed vertex position and a set of interpolated attributes that will be used by later stages.

Tessellation Shaders (HS, DS)

Introduced in Direct3D 11, tessellation allows for the dynamic subdivision of geometry on the GPU. This stage consists of two programmable shaders:

Tessellation is powerful for adding detail to low-polygon models or for procedural geometry generation.

Geometry Shader (GS)

The Geometry Shader is another programmable stage that operates on entire primitives (points, lines, or triangles) output by the IA or tessellation stages. It can:

While flexible, geometry shaders can sometimes be performance bottlenecks, and their use is often optimized or replaced by compute shaders for certain tasks.

Stream Output (SO)

The Stream Output stage, if enabled, captures the output of the Geometry Shader (or Vertex Shader if GS is not used) and writes it to vertex buffers. This is useful for:

Rasterizer Stage (RS)

The Rasterizer Stage is a fixed-function stage responsible for converting geometric primitives into pixels on the screen. Its key operations include:

The output of the rasterizer is a set of "fragments" (potential pixels) with interpolated attributes.

Pixel Shader (PS)

The Pixel Shader is a programmable stage that executes for each fragment produced by the rasterizer. Its primary role is to determine the final color of each pixel. Common tasks include:

The pixel shader is where most of the visual detail and artistic effects are realized.

Output Merger (OM)

The Output Merger Stage is the final stage of the rendering pipeline. It performs operations that combine the output of the pixel shader with the contents of the render target and depth-stencil buffers. Key operations include:

This stage ensures that objects are rendered in the correct order and that visual effects like transparency are handled correctly.

Understanding each stage of this pipeline is crucial for optimizing rendering performance and achieving desired visual outcomes in DirectX applications.