From f3f1a2bb5d53db7feb7934e89c9d8019a12a7eaf Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 23 Apr 2025 03:17:39 +0300 Subject: [PATCH] rsx: Cache draw subranges storage --- rpcs3/Emu/RSX/NV47/FW/draw_call.cpp | 5 +++-- rpcs3/Emu/RSX/NV47/FW/draw_call.hpp | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp b/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp index d31ea4a51d..8f06f413aa 100644 --- a/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp +++ b/rpcs3/Emu/RSX/NV47/FW/draw_call.cpp @@ -138,7 +138,7 @@ namespace rsx is_disjoint_primitive = is_primitive_disjointed(primitive); } - simple_array draw_clause::get_subranges() const + const simple_array& draw_clause::get_subranges() const { ensure(!is_single_draw()); @@ -146,7 +146,8 @@ namespace rsx const auto limit = range.first + range.count; const auto _pass_count = pass_count(); - simple_array ret; + auto &ret = subranges_store; + ret.clear(); ret.reserve(_pass_count); u32 previous_barrier = range.first; diff --git a/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp b/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp index 1764bca99b..b9e808e5c1 100644 --- a/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp +++ b/rpcs3/Emu/RSX/NV47/FW/draw_call.hpp @@ -35,6 +35,9 @@ namespace rsx // Draw-time iterator to the draw_command_barriers struct mutable simple_array::iterator current_barrier_it; + // Subranges memory cache + mutable rsx::simple_array subranges_store; + // Helper functions // Add a new draw command void append_draw_command(const draw_range_t& range) @@ -298,6 +301,6 @@ namespace rsx * Returns a compiled list of all subdraws. * NOTE: This is a non-trivial operation as it takes disjoint primitive boundaries into account. */ - simple_array get_subranges() const; + const simple_array& get_subranges() const; }; }