From 48cb265c2c27ca5d15ad8075c52ac0f85aceaf69 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 29 Apr 2019 18:41:02 +0300 Subject: [PATCH] rsx: Bounds check on local resource for atlas merge. - Local resources can also have padded pitch dimensions and false-positives on range overlap tests --- rpcs3/Emu/RSX/Common/texture_cache.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 10d6cfaa89..9102c7499e 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -1753,6 +1753,14 @@ namespace rsx const auto clipped = rsx::intersect_region(address, slice_w, slice_h, bpp, section->get_section_base(), normalized_width, section->get_height(), section_bpp, pitch); + // Rect intersection test + // TODO: Make the intersection code cleaner with proper 2D regions + if (std::get<0>(clipped).x >= section->get_width()) + { + // Overlap lies outside the image area! + return; + } + const auto slice_begin = u32(slice * src_slice_h); const auto slice_end = u32(slice_begin + slice_h);