From fe1bc18ac928511c62568ad9ee45770254f74992 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 19 Sep 2023 03:31:07 +0300 Subject: [PATCH] vk: Fix section merge calculations when using a temp resource --- rpcs3/Emu/RSX/VK/VKTextureCache.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.cpp b/rpcs3/Emu/RSX/VK/VKTextureCache.cpp index a22783addf..1a46702e81 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.cpp +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.cpp @@ -384,15 +384,15 @@ namespace vk { // Either a bitcast is required or a scale+copy to mipmap level / layer const u32 requested_width = dst->width(); - const u32 requested_height = src_y + src_h + section.dst_h; + const u32 requested_height = src_y + src_h + section.dst_h; // Accounts for possible typeless ref on the same helper on src _dst = vk::get_typeless_helper(src_image->format(), src_image->format_class(), requested_width, requested_height); _dst->change_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); } - if (_dst == src_image) + if (_dst != dst) { - // Write-to-self situation. Account for the initial typeless copy. - ensure(dst != _dst); + // We place the output after the source to account for the initial typeless-xfer if applicable + // If src_image == _dst then this is just a write-to-self. Either way, use best-fit placement. dst_x = 0; dst_y = src_y + src_h; }