How DXR 1.1 Inline Ray Tracing Cuts Shader Overhead

DirectX Raytracing (DXR) Tier 1.1 introduced inline ray tracing, also known as ray queries, providing developers with an alternative to traditional dynamic ray tracing pipelines. This article examines how inline ray tracing eliminates the performance overhead associated with the Shader Binding Table (SBT) and dynamic shader dispatches. By enabling ray traversal directly within existing shader stages—such as compute or pixel shaders—inline ray tracing bypasses dynamic function calls, reduces register pressure, and streamlines the ray traversal process for performance-critical rendering tasks.

The Overhead of Traditional DXR 1.0 Dispatches

In DXR Tier 1.0, ray tracing relies on the DispatchRays API call and a fully pipeline-driven execution model. Under this architecture, the GPU traverses acceleration structures and relies on the Shader Binding Table to resolve what happens when a ray hits an object or misses entirely.

The SBT acts as an array of records matching geometry instances to specific shader identifiers (such as Any-Hit, Closest-Hit, Intersection, and Miss shaders) along with their corresponding resources. Executing shaders via the SBT introduces significant performance costs:

  • Dynamic Indirection: The GPU must look up function pointers or shader identifiers dynamically based on the geometry hit during traversal.
  • Context Switching and Stack Management: Switching between distinct hit shaders requires maintaining a shader call stack, saving and restoring execution state, and managing heterogeneous ray payloads.
  • Register Pressure: The GPU must allocate registers based on the worst-case scenario across all shaders that could be invoked by the SBT, often limiting wave/warp occupancy across the entire ray tracing dispatch.
  • Thread Divergence: Adjacent rays in a wavefront that hit different surfaces branch into entirely different shaders, breaking execution coherency and stalling execution units.

How Inline Ray Tracing Bypasses the Shader Binding Table

DXR Tier 1.1 resolves these bottlenecks by introducing RayQuery objects into standard High-Level Shader Language (HLSL) code. Instead of handing execution control over to a separate pipeline state object managed by the driver, the originating shader retains complete control over the ray traversal loop.

1. Direct Execution Within Existing Stages

Inline ray tracing operates inside ordinary compute, pixel, or vertex shaders. There is no call to DispatchRays and no separate Ray Generation shader. Rays are initialized and traversed natively inside the active thread, entirely circumventing the setup, memory structures, and indexing logic required to traverse an SBT.

2. Rejection of Dynamic Function Dispatch

Because hit shaders are eliminated, the GPU never performs indirect jumps to external Closest-Hit or Any-Hit functions. When a RayQuery detects an intersection, the host shader processes the result using standard procedural code (such as if-else blocks or flat loops). The GPU treats the intersection test as a data query rather than a trigger for an external function execution.

3. Flattened Control Flow and Loop-Driven Traversal

Ray traversal is driven explicitly through an API loop using methods like RayQuery::Proceed(). The shader steps through acceleration structures iteratively:

  • Candidates (such as non-opaque geometry requiring alpha testing) are returned directly to the loop body.
  • The host shader decides whether to commit or reject the intersection on the spot.
  • Fully opaque geometry is handled automatically by the hardware traversal engine without interrupting the shader.

This design converts what used to be a dynamic, fragmented call graph into deterministic, localized control flow.

4. Unified Register Footprints

Without the need to accommodate the disparate register demands of multiple hit shaders from an SBT, the compiler optimizes registers solely for the host shader. Ray payloads do not need to be packaged into generic memory buffers or saved across function boundaries. Local variables remain in their allocated registers, which drastically reduces memory spillover to scratch space and maintains higher GPU occupancy.

Optimal Use Cases

By discarding the Shader Binding Table, inline ray tracing provides significant throughput gains in scenarios where dynamic shading is unnecessary. It is especially effective for:

  • Shadow Rays and Ambient Occlusion: Simple boolean visibility queries where any hit constitutes a blockage, requiring no complex material shading.
  • Compute-Based Pre-Passes: Screen-space or world-space spatial data structures where compute shaders require fast geometric intersection tests without pipeline state churn.
  • Light Culling and Probes: Fast gathering of scene visibility data where dynamic material evaluation would add redundant scheduling overhead.