From 629ebf1bdee023d3d3ecc96c3276cf3285f8f727 Mon Sep 17 00:00:00 2001 From: simply0001 Date: Fri, 26 Jun 2026 04:15:31 +0200 Subject: [video_core/maxwell3d] compute macro param address on demand (#4067) GetMacroAddress only reads a couple of indices per macro, but ProcessMacro was then building a full std::vector GPUVAddr> with one push_back per parameter word every submission. macro_segments already holds base, count per chunk, so GetMacroAddress can just walk it instead, drops the per-word loop, a .clear(), and a vector member. Also makes it so it returns on the first match in the macro dispatch instead of running every std::get_if check. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4067 Reviewed-by: Lizzie Reviewed-by: CamilleLaVey --- src/video_core/macro.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/video_core/macro.cpp') diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp index 2833f95ee9..0d026a1ce5 100644 --- a/src/video_core/macro.cpp +++ b/src/video_core/macro.cpp @@ -1356,33 +1356,33 @@ static void Dump(u64 hash, std::span code, bool decompiled = false) { void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u32 method, std::span parameters) { auto const execute_variant = [&system, &maxwell3d, ¶meters, method](AnyCachedMacro& acm) { if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if(&acm)) - a->Execute(system, maxwell3d, parameters, method); + return a->Execute(system, maxwell3d, parameters, method); if (auto a = std::get_if>(&acm)) - a->get()->Execute(system, maxwell3d, parameters, method); + return a->get()->Execute(system, maxwell3d, parameters, method); }; if (auto const it = macro_cache.find(method); it != macro_cache.end()) { auto& ci = it->second; -- cgit v1.2.3