From 7786681954e6485baa9dc323d66701a8f94eebf9 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 2 Jan 2020 18:02:26 +0300 Subject: [PATCH] rsx: Improve MTRSX synchronization - Properly synchronize DMA transfers when handling RSX pipeline barriers. Texture read barrier is used to signify completion of DMA routines and is often used to signal that Cell can overwrite vertex data! --- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 2 ++ rpcs3/Emu/RSX/rsx_methods.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index e862c897c5..165df436c1 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -2876,6 +2876,8 @@ void VKGSRender::close_and_submit_command_buffer(vk::fence* pFence, VkSemaphore // NOTE: There is no need to wait for dma sync. When MTRSX is enabled, the commands are submitted in order anyway due to CSMT if (vk::test_status_interrupt(vk::heap_dirty)) { + rsx::g_dma_manager.sync(); + if (m_attrib_ring_info.dirty() || m_fragment_env_ring_info.dirty() || m_vertex_env_ring_info.dirty() || diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 757f7c4996..d30e8be3d1 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -203,6 +203,8 @@ namespace rsx void texture_read_semaphore_release(thread* rsx, u32 _reg, u32 arg) { // Pipeline barrier seems to be equivalent to a SHADER_READ stage barrier + rsx::g_dma_manager.sync(); + // lle-gcm likes to inject system reserved semaphores, presumably for system/vsh usage // Avoid calling render to avoid any havoc(flickering) they may cause from invalid flush/write const u32 offset = method_registers.semaphore_offset_4097() & -16; @@ -217,6 +219,7 @@ namespace rsx void back_end_write_semaphore_release(thread* rsx, u32 _reg, u32 arg) { // Full pipeline barrier + rsx::g_dma_manager.sync(); rsx->sync(); const u32 offset = method_registers.semaphore_offset_4097() & -16;