From 9034e6d0b8cc10c11b24a4e3c55ca5c3c8b906ac Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Sun, 11 Jan 2026 00:29:29 -0400 Subject: [PATCH] [engines, maxwell] Pre-allocate macro vectors --- src/video_core/engines/maxwell_3d.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index d8d2ad74c6..2cc5852cea 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -196,15 +196,19 @@ bool Maxwell3D::IsMethodExecutable(u32 method) { void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool is_last_call) { if (executing_macro == 0) { - // A macro call must begin by writing the macro method's register, not its argument. ASSERT_MSG((method % 2) == 0, "Can't start macro execution by writing to the ARGS register"); executing_macro = method; + macro_params.reserve(64); + macro_addresses.reserve(64); + macro_segments.reserve(8); } macro_params.insert(macro_params.end(), base_start, base_start + amount); + const size_t old_size = macro_addresses.size(); + macro_addresses.resize(old_size + amount); for (size_t i = 0; i < amount; i++) { - macro_addresses.push_back(current_dma_segment + i * sizeof(u32)); + macro_addresses[old_size + i] = current_dma_segment + i * sizeof(u32); } macro_segments.emplace_back(current_dma_segment, amount); current_macro_dirty |= current_dirty;