From a9f1dd20c36e28457eacfcd30952a700a88cb557 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 6 Apr 2025 17:14:01 +1000 Subject: [PATCH] D3D12Device: Fix GPU-based validation being unconditionally enabled --- src/util/d3d12_device.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util/d3d12_device.cpp b/src/util/d3d12_device.cpp index 92344bc77..ff075502e 100644 --- a/src/util/d3d12_device.cpp +++ b/src/util/d3d12_device.cpp @@ -191,16 +191,19 @@ bool D3D12Device::CreateDeviceAndMainSwapChain(std::string_view adapter, Feature INFO_LOG("Enabling debug layer."); debug12->EnableDebugLayer(); - ComPtr debug12_1; - if (SUCCEEDED(debug12.As(&debug12_1))) + if (m_debug_device_gpu_validation) { - INFO_LOG("Enabling GPU-based validation."); - debug12_1->SetEnableGPUBasedValidation(true); - } - else - { - ERROR_LOG("GPU-based validation requested but not available."); - m_debug_device_gpu_validation = false; + ComPtr debug12_1; + if (SUCCEEDED(debug12.As(&debug12_1))) + { + INFO_LOG("Enabling GPU-based validation."); + debug12_1->SetEnableGPUBasedValidation(true); + } + else + { + ERROR_LOG("GPU-based validation requested but not available."); + m_debug_device_gpu_validation = false; + } } } else