mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 03:46:42 +01:00
Merge pull request #10777 from tellowkrinkle/EFBFlush
VideoCommon: Remember to flush command buffers after multiple EFB copies
This commit is contained in:
commit
e237aa1435
@ -789,6 +789,16 @@ void VertexManagerBase::OnDraw()
|
|||||||
{
|
{
|
||||||
m_draw_counter++;
|
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 we didn't have any CPU access last frame, do nothing.
|
||||||
if (m_scheduled_command_buffer_kicks.empty() || !m_allow_background_execution)
|
if (m_scheduled_command_buffer_kicks.empty() || !m_allow_background_execution)
|
||||||
return;
|
return;
|
||||||
@ -800,6 +810,8 @@ void VertexManagerBase::OnDraw()
|
|||||||
{
|
{
|
||||||
// Kick a command buffer on the background thread.
|
// Kick a command buffer on the background thread.
|
||||||
g_renderer->Flush();
|
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;
|
const u32 diff = m_draw_counter - m_last_efb_copy_draw_counter;
|
||||||
m_last_efb_copy_draw_counter = m_draw_counter;
|
m_last_efb_copy_draw_counter = m_draw_counter;
|
||||||
if (diff < MINIMUM_DRAW_CALLS_PER_COMMAND_BUFFER_FOR_READBACK)
|
if (diff < MINIMUM_DRAW_CALLS_PER_COMMAND_BUFFER_FOR_READBACK)
|
||||||
|
{
|
||||||
|
m_unflushed_efb_copy = true;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_unflushed_efb_copy = false;
|
||||||
g_renderer->Flush();
|
g_renderer->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +212,7 @@ private:
|
|||||||
// CPU access tracking
|
// CPU access tracking
|
||||||
u32 m_draw_counter = 0;
|
u32 m_draw_counter = 0;
|
||||||
u32 m_last_efb_copy_draw_counter = 0;
|
u32 m_last_efb_copy_draw_counter = 0;
|
||||||
|
bool m_unflushed_efb_copy = false;
|
||||||
std::vector<u32> m_cpu_accesses_this_frame;
|
std::vector<u32> m_cpu_accesses_this_frame;
|
||||||
std::vector<u32> m_scheduled_command_buffer_kicks;
|
std::vector<u32> m_scheduled_command_buffer_kicks;
|
||||||
bool m_allow_background_execution = true;
|
bool m_allow_background_execution = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user