summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexManagerBase.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-07-13 19:45:31 -0400
committerGitHub <noreply@github.com>2022-07-13 19:45:31 -0400
commite237aa143509ddcdf4d23b634607e4c65dd48129 (patch)
tree2b3db44957dae409a86282894154099200d9d77c /Source/Core/VideoCommon/VertexManagerBase.cpp
parent5663a44962580fb9d069fc29d9247f78c440cf39 (diff)
parent3ee4b89a4681b0caa51c9eaad54ea153f36ff00c (diff)
Merge pull request #10777 from tellowkrinkle/EFBFlush
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.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp
index b3d6f86686..22245f1db2 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.cpp
+++ b/Source/Core/VideoCommon/VertexManagerBase.cpp
@@ -789,6 +789,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;
@@ -800,6 +810,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;
}
}
@@ -826,8 +838,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();
}