D3D11Device: Always query timestamp before present start

Fixes high GPU usage reporting in D3D11 with AMD GPUs + Optimal Frame
Pacing.
This commit is contained in:
Stenzek 2025-02-07 15:58:35 +10:00
parent 5ae6d9084a
commit 063bb96e5d
No known key found for this signature in database
1 changed files with 2 additions and 8 deletions

View File

@ -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<UINT>(SC->GetVSyncMode() == GPUVSyncMode::FIFO);
const UINT flags =
(SC->GetVSyncMode() == GPUVSyncMode::Disabled && SC->IsUsingAllowTearing()) ? DXGI_PRESENT_ALLOW_TEARING : 0;