From fe3cbde1d3a0b18edca4c978fdb36779a1e8cd24 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 28 Mar 2026 03:10:31 +0300 Subject: [PATCH] rsx: Add optimization to skip cloning surfaces whose dimensions did not change - If only the threshold changed or the surface is below threshold anyway, nothing will change - In those cases, just update the internal data and continue --- rpcs3/Emu/RSX/Common/surface_store.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 0cfbbe849c..70007178fa 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -1485,6 +1485,21 @@ namespace rsx continue; } + // Perform a test scaling and check if anything is different after scaling + // There are many cases where this will avoid creating new surfaces + const auto [new_w, new_h] = rsx::apply_inverse_resolution_scale( + active_config, + surface->template get_surface_width<>(), + surface->template get_surface_height<>()); + + if (new_w == surface->width() && new_h == surface->height()) + { + // Not affected by resolution scale. Just update the details and move on. + surface->resolution_scaling_config = active_config; + ++It; + continue; + } + surfaces_to_clone.push_back(surface); // Invalidate the previous surface