From 9dab0575fa3fd8ba0c3e089464427723f750ca6c Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 17 Nov 2019 23:30:21 +0300 Subject: [PATCH] rsx: Add missing format check for the RTV<->DSV transfer case - TODO: Rewrite resource handling routines --- rpcs3/Emu/RSX/Common/texture_cache.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index c4785bc69c..3d59fe1f79 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -2586,6 +2586,34 @@ namespace rsx // Need to lock the affected memory range and actually attach this subres to a locked_region dst_subres.surface->on_write_copy(rsx::get_shared_tag()); m_rtts.notify_memory_structure_changed(); + + if (src_is_render_target) + { + if (helpers::is_gcm_depth_format(typeless_info.src_gcm_format) != + helpers::is_gcm_depth_format(typeless_info.dst_gcm_format)) + { + verify(HERE), !typeless_info.dst_is_typeless || !typeless_info.src_is_typeless; + verify(HERE), src_is_argb8 == dst_is_argb8; + + if (typeless_info.src_is_typeless == typeless_info.dst_is_typeless) + { + // None are typeless. Cast src + typeless_info.src_is_typeless = true; + typeless_info.src_gcm_format = helpers::get_sized_blit_format(src_is_argb8, dst_subres.is_depth); + } + else if (typeless_info.src_is_typeless) + { + // Src is already getting cast + typeless_info.src_gcm_format = typeless_info.dst_gcm_format; + } + else + { + // Dst is already getting cast + verify(HERE), typeless_info.dst_is_typeless; + typeless_info.dst_gcm_format = typeless_info.src_gcm_format; + } + } + } } if (rsx::get_resolution_scale_percent() != 100)