How DirectX Supports HDR Output Through DXGI

This article explains how Microsoft DirectX facilitates High Dynamic Range (HDR) rendering and display output via the DirectX Graphics Infrastructure (DXGI). It covers how applications detect HDR-capable displays, configure the appropriate swap chain formats and color spaces, pass mastering metadata to the display hardware, and manage the rendering pipeline to deliver expanded contrast and wider color gamuts on modern monitors.

Display Capability Detection

DirectX handles display hardware communication through DXGI. To determine if a connected monitor supports HDR, an application queries the output interface using IDXGIOutput6. Calling IDXGIOutput6::GetDesc1 populates a DXGI_OUTPUT_DESC1 structure, which provides vital display metrics:

  • Color Space Capabilities: Indicates whether the monitor supports high-bit-depth formats and wide color gamuts such as BT.2020.
  • Luminance Range: Exposes the display's MinLuminance, MaxLuminance, and MaxFullFrameLuminance in nits (cd/m²). Applications use these values to calibrate tone mapping dynamically to match physical panel limits.

Applications also monitor system notifications or poll for display changes to detect when a user toggles Windows HDR on or off.

Swap Chain Configuration and Color Spaces

Once HDR support is verified, the application configures an IDXGISwapChain (typically version 3 or 4) to handle high-bit-depth frame buffers. DXGI natively supports two primary HDR approaches:

  1. scRGB (Linear Floating-Point):
    • Pixel Format: DXGI_FORMAT_R16G16B16A16_FLOAT (FP16).
    • Color Space: DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709.
    • Behavior: Uses a linear gamma where a value of 1.0 represents standard SDR white (80 nits), and values greater than 1.0 represent highlights. This is often the preferred choice for game engines because scene lighting calculations can be passed directly to the swap chain without manual perceptual quantization.
  2. HDR10 (Perceptual Quantizer / BT.2020):
    • Pixel Format: DXGI_FORMAT_R10G10B10A2_UNORM (10-bit integer).
    • Color Space: DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020.
    • Behavior: Encodes color using the SMPTE ST 2084 Perceptual Quantizer (PQ) curve and the BT.2020 wide color gamut. Values are strictly mapped from 0 to 10,000 nits non-linearly.

The application applies the target color space to the swap chain by calling IDXGISwapChain3::SetColorSpace1.

Transmitting HDR Metadata

For HDR10 pipelines, the display requires static metadata to tone map the incoming signal properly. DXGI provides this functionality via IDXGISwapChain4::SetHDRMetaData.

Developers supply a DXGI_HDR_METADATA_HDR10 structure containing:

  • Mastering Display Chromaticities: The CIE 1931 xy coordinates for the red, green, blue primary color points and the white point of the display used to master the content.
  • Luminance Boundaries: The minimum and maximum mastering display luminance.
  • MaxCLL (Maximum Content Light Level): The luminance of the brightest individual pixel in the content.
  • MaxFALL (Maximum Frame Average Light Level): The maximum average frame luminance of the content.

This metadata enables the physical panel to compress luminance out-of-range values gracefully rather than hard-clipping highlights.

DirectFlip and Windowed Composition

When running in windowed or borderless modes, DXGI integrates with the Desktop Window Manager (DWM). When the application presents an HDR swap chain, DWM composites standard dynamic range (SDR) and HDR applications together into an internal canonical color space.

If the application is running fullscreen or meets DirectFlip requirements, DXGI bypasses the DWM composition pass, sending the swap chain buffers directly to the display driver. This minimizes latency and avoids unintended color transformations or clamping.