From 298f68a6ed937f6f6e22835673867aa8043ec6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 11 Jul 2026 23:52:45 -0700 Subject: [PATCH] D3D12: Disable GPU based validation when graphics debugger is present. (#3823) --- src/debug_renderdoc.cpp | 2 +- src/renderer_d3d12.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/debug_renderdoc.cpp b/src/debug_renderdoc.cpp index 8c81ec9a1..202d3bd9b 100644 --- a/src/debug_renderdoc.cpp +++ b/src/debug_renderdoc.cpp @@ -70,7 +70,7 @@ namespace bgfx s_renderDoc->SetCaptureKeys(captureKeys, BX_COUNTOF(captureKeys) ); s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_AllowVSync, 1); - s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_APIValidation, 1); + s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_APIValidation, 0); s_renderDoc->MaskOverlayBits(eRENDERDOC_Overlay_None, eRENDERDOC_Overlay_None); diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 343a5265b..b0de16695 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -925,7 +925,18 @@ namespace bgfx { namespace d3d12 // Setting SetEnableSynchronizedCommandQueueValidation below to false avoids the bug // It was fixed in (probably) the first windows 11 sdk, 22000 // However, the fix causes any dx12 context with validation to break if this is set to false, so we can't do that anymore - if (windowsVersionIs(Condition::GreaterEqual, 0x0A00, 22000) ) + const bool graphicsDebugger = false + || NULL != m_renderDocDll + || NULL != m_winPixEvent + ; + + if (graphicsDebugger) + { + // RenderDoc/PIX already hook and wrap the D3D12 device. GPU-based validation conflicts + // with that wrapping and can intermittently deadlock CreateGraphicsPipelineState during + // heavy PSO creation. + } + else if (windowsVersionIs(Condition::GreaterEqual, 0x0A00, 22000) ) { debug1->SetEnableGPUBasedValidation(true); }