From e55d216619dc2f52310ea64ef4ddd3e99e3afc4e Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 28 Aug 2019 12:54:34 +0300 Subject: [PATCH] rsx: Workarounds for some buggy games - Replace assert with log message until hardware testing confirms findings --- rpcs3/Emu/RSX/Common/surface_store.h | 9 ++++++++- rpcs3/Emu/RSX/Common/texture_cache.h | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 2483457967..47d80c4b3e 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -756,7 +756,14 @@ namespace rsx const auto surface_internal_pitch = (required_width * required_bpp); - verify(HERE), surface_internal_pitch <= required_pitch; + // Sanity check + if (UNLIKELY(surface_internal_pitch > required_pitch)) + { + LOG_WARNING(RSX, "Invalid 2D region descriptor. w=%d, h=%d, bpp=%d, pitch=%d", + required_width, required_height, required_bpp, required_pitch); + return {}; + } + const auto test_range = utils::address_range::start_length(texaddr, (required_pitch * required_height) - (required_pitch - surface_internal_pitch)); auto process_list_function = [&](std::unordered_map& data, bool is_depth) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 92e5858393..71784a623f 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -2023,8 +2023,10 @@ namespace rsx scale_x = 0.f; scale_y = 0.f; } - else if (extended_dimension == rsx::texture_dimension_extended::texture_dimension_1d) + else if (required_surface_height == 1) { + // Pitch doesn't matter when height=1 and some games abuse this fact + tex_pitch = std::max(tex_pitch, get_format_packed_pitch(format, tex_width, !tex.border_type(), !linear)); scale_y = 0.f; }