From 7109fe9889315fd29ef728ac5327c2630c3a4823 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 5 Aug 2020 22:50:31 +0300 Subject: [PATCH] rsx: Improve swizzled layout detection - Reset swizzle flag to false automatically on section reset. - Detect render target payload and extract swizzle information from it. --- rpcs3/Emu/RSX/Common/texture_cache_utils.h | 1 + rpcs3/Emu/RSX/GL/GLTextureCache.h | 5 +++++ rpcs3/Emu/RSX/VK/VKTextureCache.h | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/rpcs3/Emu/RSX/Common/texture_cache_utils.h b/rpcs3/Emu/RSX/Common/texture_cache_utils.h index c03fd4bfc6..ca99e7fea6 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_utils.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_utils.h @@ -1089,6 +1089,7 @@ namespace rsx gcm_format = 0; pack_unpack_swap_bytes = false; + swizzled = false; sync_timestamp = 0ull; synchronized = false; diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index d094e960ae..8b096bb455 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -95,6 +95,11 @@ namespace gl ASSERT(!managed_texture); } + if (auto rtt = dynamic_cast(image)) + { + swizzled = (rtt->raster_type != rsx::surface_raster_type::linear); + } + flushed = false; synchronized = false; sync_timestamp = 0ull; diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index 123ffc8c12..1ea7c2a0fb 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -66,6 +66,11 @@ namespace vk managed_texture.reset(vram_texture); } + if (auto rtt = dynamic_cast(image)) + { + swizzled = (rtt->raster_type != rsx::surface_raster_type::linear); + } + if (synchronized) { // Even if we are managing the same vram section, we cannot guarantee contents are static