1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

vk: Drain the label queue before using the CPU fallback to avoid out-of-order signals

- This avoids crashes in some game engines which expect RSX semaphores to signal in the order they are submitted.
This commit is contained in:
kd-11 2022-02-23 01:50:21 +03:00 committed by kd-11
parent 6fd2a9b677
commit 6b8b23c401

View File

@ -1496,24 +1496,25 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args)
return false; return false;
} }
auto drain_label_queue = [this]()
{
while (m_host_data_ptr->last_label_release_event > m_host_data_ptr->commands_complete_event)
{
_mm_pause();
if (thread_ctrl::state() == thread_state::aborting)
{
break;
}
}
};
ensure(m_host_data_ptr); ensure(m_host_data_ptr);
if (m_host_data_ptr->texture_load_complete_event == m_host_data_ptr->texture_load_request_event) if (m_host_data_ptr->texture_load_complete_event == m_host_data_ptr->texture_load_request_event)
{ {
// All texture loads already seen by the host GPU // All texture loads already seen by the host GPU
// Wait for all previously submitted labels to be flushed // Wait for all previously submitted labels to be flushed
if (m_host_data_ptr->last_label_release_event > m_host_data_ptr->commands_complete_event) drain_label_queue();
{
while (m_host_data_ptr->last_label_release_event > m_host_data_ptr->commands_complete_event)
{
_mm_pause();
if (thread_ctrl::state() == thread_state::aborting)
{
break;
}
}
}
return false; return false;
} }
@ -1525,6 +1526,7 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args)
// NVIDIA GPUs can disappoint when DMA blocks straddle VirtualAlloc boundaries. // NVIDIA GPUs can disappoint when DMA blocks straddle VirtualAlloc boundaries.
// Take the L and try the fallback. // Take the L and try the fallback.
rsx_log.warning("Host label update at 0x%x was not possible.", address); rsx_log.warning("Host label update at 0x%x was not possible.", address);
drain_label_queue();
return false; return false;
} }