From 063bb96e5d2fe67a256aa733e454407671489e86 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 7 Feb 2025 15:58:35 +1000 Subject: [PATCH] D3D11Device: Always query timestamp before present start Fixes high GPU usage reporting in D3D11 with AMD GPUs + Optimal Frame Pacing. --- src/util/d3d11_device.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/util/d3d11_device.cpp b/src/util/d3d11_device.cpp index 1ad9d28b9..c18b606d3 100644 --- a/src/util/d3d11_device.cpp +++ b/src/util/d3d11_device.cpp @@ -685,11 +685,11 @@ GPUDevice::PresentResult D3D11Device::BeginPresent(GPUSwapChain* swap_chain, u32 return PresentResult::ExclusiveFullscreenLost; } - // When using vsync, the time here seems to include the time for the buffer to become available. + // The time here seems to include the time for the buffer to become available. // This blows our our GPU usage number considerably, so read the timestamp before the final blit // in this configuration. It does reduce accuracy a little, but better than seeing 100% all of // the time, when it's more like a couple of percent. - if (SC == m_main_swap_chain.get() && SC->GetVSyncMode() == GPUVSyncMode::FIFO && m_gpu_timing_enabled) + if (SC == m_main_swap_chain.get() && m_gpu_timing_enabled) { PopTimestampQuery(); EndTimestampQuery(); @@ -711,12 +711,6 @@ void D3D11Device::EndPresent(GPUSwapChain* swap_chain, bool explicit_present, u6 DebugAssert(!explicit_present && present_time == 0); DebugAssert(m_num_current_render_targets == 0 && !m_current_depth_target); - if (SC == m_main_swap_chain.get() && SC->GetVSyncMode() != GPUVSyncMode::FIFO && m_gpu_timing_enabled) - { - PopTimestampQuery(); - EndTimestampQuery(); - } - const UINT sync_interval = static_cast(SC->GetVSyncMode() == GPUVSyncMode::FIFO); const UINT flags = (SC->GetVSyncMode() == GPUVSyncMode::Disabled && SC->IsUsingAllowTearing()) ? DXGI_PRESENT_ALLOW_TEARING : 0;