diff options
| author | TellowKrinkle <tellowkrinkle@gmail.com> | 2022-06-23 02:55:46 -0500 |
|---|---|---|
| committer | TellowKrinkle <tellowkrinkle@gmail.com> | 2022-07-06 18:38:05 -0500 |
| commit | 3ee4b89a4681b0caa51c9eaad54ea153f36ff00c (patch) | |
| tree | f46f0f4ad2ed7029930b5441b6a2738ba9d3884f /Source/Core/VideoCommon/VertexManagerBase.cpp | |
| parent | ec7bf7d1ecbdeb3bea5ce19f012f884ab8e2bab7 (diff) | |
VideoCommon: Remember to flush command buffers after multiple EFB copies
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 72f02927b5..670fcaf607 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -757,6 +757,16 @@ void VertexManagerBase::OnDraw() { m_draw_counter++; + // If the last efb copy was too close to the one before it, don't forget about it until the next + // efb copy happens (which might not be for a long time) + u32 diff = m_draw_counter - m_last_efb_copy_draw_counter; + if (m_unflushed_efb_copy && diff > MINIMUM_DRAW_CALLS_PER_COMMAND_BUFFER_FOR_READBACK) + { + g_renderer->Flush(); + m_unflushed_efb_copy = false; + m_last_efb_copy_draw_counter = m_draw_counter; + } + // If we didn't have any CPU access last frame, do nothing. if (m_scheduled_command_buffer_kicks.empty() || !m_allow_background_execution) return; @@ -768,6 +778,8 @@ void VertexManagerBase::OnDraw() { // Kick a command buffer on the background thread. g_renderer->Flush(); + m_unflushed_efb_copy = false; + m_last_efb_copy_draw_counter = m_draw_counter; } } @@ -794,8 +806,12 @@ void VertexManagerBase::OnEFBCopyToRAM() const u32 diff = m_draw_counter - m_last_efb_copy_draw_counter; m_last_efb_copy_draw_counter = m_draw_counter; if (diff < MINIMUM_DRAW_CALLS_PER_COMMAND_BUFFER_FOR_READBACK) + { + m_unflushed_efb_copy = true; return; + } + m_unflushed_efb_copy = false; g_renderer->Flush(); } |
