In-Game GPU Profiling for DirectX 12 Using SetBackgroundProcessingMode

thumbnail

In-Game GPU Profiling for DirectX 12 Using SetBackgroundProcessingMode

  • Developers of DirectX 12 games may notice that GPU times displayed in real-time in the game HUD can change over time for a given pass.
  • One factor to consider is whether background driver optimizations were engaged and when their resulting optimized shaders were deployed.
  • By using the SetBackgroundProcessingMode API, developers can request that the driver background optimizations stay always on, even if it may degrade frame rate.
  • Waiting for background driver optimization threads ensures that all background compiles are completed before GPU performance measurements are taken.
  • The return value of the Wait for background driver optimization threads can be displayed in the game HUD to indicate if background compiles are still running.
  • Resetting the background processing mode to the default mode allows the driver to turn background optimizations on and off depending on internal heuristics.
  • By utilizing the background processing mode and displaying the Boolean value in the game HUD, developers can obtain more reliable GPU timing measurements in their in-game GPU profiler.
  • This approach allows for more deterministic performance measurements on NVIDIA GPUs and eliminates discrepancies caused by varying CPU load.