From 0f99a77250d089d5ee9afe011564c71866c2dadd Mon Sep 17 00:00:00 2001 From: Takoroka <137927095+Takoroka@users.noreply.github.com> Date: Wed, 28 Oct 2026 23:46:54 -0400 Subject: nx2: EDEN_NX2_MME_RECORD records macro calls for offline interpreter checks Writes the first 200,000 native macro calls (start, parameters) and the macro code, so an interpreter change can be replayed against the previous interpreter (all 200,000 matched for the operand-slot rewrite, which was then dropped as no faster). --- src/video_core/macro.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/video_core/macro.cpp') diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp index c74cd6087a..73d5d8e5e1 100644 --- a/src/video_core/macro.cpp +++ b/src/video_core/macro.cpp @@ -1363,6 +1363,25 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u auto& fifo = native_fifo; fifo.assign(parameters.begin(), parameters.end()); native_interpreter.active_dram = &maxwell3d.GetNativeDataRam(); + // EDEN_NX2_MME_RECORD=: write the first 200000 calls (u32 start, u32 count, the + // parameters) and then the macro code to .code, to check interpreter changes + // offline against the previous interpreter. + if (static const char* const record_path = std::getenv("EDEN_NX2_MME_RECORD"); record_path != nullptr) { + static std::ofstream record{record_path, std::ios::binary}; + static u32 recorded{}; + if (recorded < 200000) { + const u32 count = static_cast(parameters.size()); + record.write(reinterpret_cast(&method), sizeof(method)); + record.write(reinterpret_cast(&count), sizeof(count)); + record.write(reinterpret_cast(parameters.data()), parameters.size_bytes()); + if (++recorded == 200000) { + record.flush(); + std::ofstream code{std::string{record_path} + ".code", std::ios::binary}; + code.write(reinterpret_cast(native_code.data()), sizeof(native_code)); + LOG_INFO(HW_GPU, "Recorded 200000 macro calls to {}", record_path); + } + } + } const auto result = native_interpreter.Execute(native_code, method, fifo, [&](u32 address) { return address < Maxwell3D::Regs::NUM_REGS ? maxwell3d.GetRegisterValue(address) : 0U; }, [&](u32 address, u32 value) { -- cgit v1.2.3