From d000d648b030e1aefe7eb1a9120d632fa172dc93 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 26 Aug 2020 23:55:28 +0300 Subject: [PATCH] vk: Fix some minor spec violation - Stencil clear pass does not consume an image, do not bind one. - Add push_barrier to allow push-pop semantics for texture barrier insert. --- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 6 ++---- rpcs3/Emu/RSX/VK/VKHelpers.h | 6 ++++++ rpcs3/Emu/RSX/VK/VKOverlays.h | 3 +-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 42a603707e..4af3f89255 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -1190,8 +1190,7 @@ void VKGSRender::clear_surface(u32 mask) if (require_mem_load) rtt->write_barrier(*m_current_command_buffer); // Add a barrier to ensure previous writes are visible; also transitions into GENERAL layout - const auto old_layout = rtt->current_layout; - vk::insert_texture_barrier(*m_current_command_buffer, rtt, VK_IMAGE_LAYOUT_GENERAL); + rtt->push_barrier(*m_current_command_buffer, VK_IMAGE_LAYOUT_GENERAL); if (!renderpass) { @@ -1201,8 +1200,7 @@ void VKGSRender::clear_surface(u32 mask) } attachment_clear_pass->run(*m_current_command_buffer, rtt, region.rect, renderpass); - - rtt->change_layout(*m_current_command_buffer, old_layout); + rtt->pop_layout(*m_current_command_buffer); } else fmt::throw_exception("Unreachable" HERE); diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index 40762f6e39..484e622c64 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -1518,6 +1518,12 @@ private: change_image_layout(cmd, this, layout); } + void push_barrier(VkCommandBuffer cmd, VkImageLayout layout) + { + m_layout_stack.push(current_layout); + insert_texture_barrier(cmd, this, layout); + } + void pop_layout(VkCommandBuffer cmd) { verify(HERE), !m_layout_stack.empty(); diff --git a/rpcs3/Emu/RSX/VK/VKOverlays.h b/rpcs3/Emu/RSX/VK/VKOverlays.h index 8a6028c57e..67bf61871c 100644 --- a/rpcs3/Emu/RSX/VK/VKOverlays.h +++ b/rpcs3/Emu/RSX/VK/VKOverlays.h @@ -1027,8 +1027,7 @@ namespace vk // Coverage sampling disabled, but actually report correct number of samples renderpass_config.set_multisample_state(target->samples(), 0xFFFF, false, false, false); - overlay_pass::run(cmd, { 0, 0, target->width(), target->height() }, target, - target->get_view(0xAAE4, rsx::default_remap_vector), render_pass); + overlay_pass::run(cmd, { 0, 0, target->width(), target->height() }, target, std::vector{}, render_pass); } };