From db014d8a582c21992c8a12667bae46888c18b2a4 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 16 Jan 2020 14:35:49 +0300 Subject: [PATCH] rsx: Fix section length calculations when generating new blit targets. --- rpcs3/Emu/RSX/Common/texture_cache.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index dc2aff4ede..55cbf52a7b 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -2492,13 +2492,15 @@ namespace rsx } } - const u32 section_length = std::max(write_end, block_end) - dst.rsx_address; - dst_dimensions.height = align2(section_length, dst.pitch) / dst.pitch; + const u32 usable_section_length = std::max(write_end, block_end) - dst.rsx_address; + dst_dimensions.height = align2(usable_section_length, dst.pitch) / dst.pitch; + + const u32 full_section_length = ((dst_dimensions.height - 1) * dst.pitch) + (dst_dimensions.width * dst_bpp); + const auto rsx_range = address_range::start_length(dst.rsx_address, full_section_length); lock.upgrade(); // NOTE: Write flag set to remove all other overlapping regions (e.g shader_read or blit_src) - const auto rsx_range = address_range::start_length(dst.rsx_address, section_length); invalidate_range_impl_base(cmd, rsx_range, invalidation_cause::write, std::forward(extras)...); if (LIKELY(use_null_region))