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
1 changed files with 15 additions and 13 deletions

View File

@ -1496,12 +1496,7 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args)
return false;
}
ensure(m_host_data_ptr);
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
// 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)
auto drain_label_queue = [this]()
{
while (m_host_data_ptr->last_label_release_event > m_host_data_ptr->commands_complete_event)
{
@ -1512,8 +1507,14 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args)
break;
}
}
}
};
ensure(m_host_data_ptr);
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
// Wait for all previously submitted labels to be flushed
drain_label_queue();
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.
// Take the L and try the fallback.
rsx_log.warning("Host label update at 0x%x was not possible.", address);
drain_label_queue();
return false;
}