From 08f346036560455dc06684e6acaf2667bd50369d Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 29 Feb 2020 11:32:46 +0300 Subject: [PATCH] vk: Fixup for RCB/RDB in special cases - Images must be in TRANSFER_DST_OPTIMAL or GENERAL layouts to call the image upload routines. --- rpcs3/Emu/RSX/VK/VKRenderTargets.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.h b/rpcs3/Emu/RSX/VK/VKRenderTargets.h index a206fc3b0a..51e41aa16c 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.h +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.h @@ -258,6 +258,9 @@ namespace vk vk::image* content = nullptr; vk::image* final_dst = (samples() > 1) ? get_resolve_target_safe(cmd) : this; + // Prepare dst image + final_dst->push_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); + if (final_dst->width() == subres.width_in_block && final_dst->height() == subres.height_in_block) { // Possible if MSAA is enabled with 100% resolution scale or @@ -277,12 +280,17 @@ namespace vk // Write into final image if (content != final_dst) { + // Avoid layout push/pop on scratch memory by setting explicit layout here + content->change_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); + vk::copy_scaled_image(cmd, content->value, final_dst->value, content->current_layout, final_dst->current_layout, { 0, 0, subres.width_in_block, subres.height_in_block }, { 0, 0, static_cast(final_dst->width()), static_cast(final_dst->height()) }, 1, aspect(), true, aspect() == VK_IMAGE_ASPECT_COLOR_BIT ? VK_FILTER_LINEAR : VK_FILTER_NEAREST, format(), format()); } + final_dst->pop_layout(cmd); + if (samples() > 1) { // Trigger unresolve