From e00abaaa3cabdb23eb837f0c3e51e75a101ec622 Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Fri, 16 Jan 2026 14:09:10 -0400 Subject: [PATCH] Revert "[engines, maxwell, video_core, dma, dirty_flags] Refactor method execution check" --- src/video_core/dirty_flags.h | 3 -- src/video_core/dma_pusher.cpp | 47 +------------------ src/video_core/engines/maxwell_3d.cpp | 67 +++++++++++++++++++++++++++ src/video_core/engines/maxwell_3d.h | 2 + 4 files changed, 70 insertions(+), 49 deletions(-) diff --git a/src/video_core/dirty_flags.h b/src/video_core/dirty_flags.h index bf90db83e6..e6dcff3fbc 100644 --- a/src/video_core/dirty_flags.h +++ b/src/video_core/dirty_flags.h @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index f124057cf6..19f8d32ebb 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -14,51 +14,6 @@ #include "video_core/rasterizer_interface.h" #include "video_core/texture_cache/util.h" -namespace { - -/// Constexpr check if method should execute immediately (replaces 8KB execution_mask bitset). -constexpr bool IsMethodExecutable(u32 method, Tegra::Engines::EngineTypes engine_type) { - constexpr u32 MacroRegistersStart = 0xE00; - if (method >= MacroRegistersStart) { - return true; - } - - using Tegra::Engines::EngineTypes; - switch (engine_type) { - case EngineTypes::Maxwell3D: - switch (method) { - case 0x0044: case 0x0045: case 0x0046: case 0x0047: case 0x0049: - case 0x006C: case 0x006D: case 0x00B2: - case 0x035D: case 0x035E: case 0x0378: case 0x03DD: case 0x03DF: - case 0x0485: case 0x0486: case 0x04C0: case 0x054C: case 0x0556: - case 0x0585: case 0x0586: case 0x057A: case 0x057B: - case 0x05F7: case 0x05F8: case 0x05F9: case 0x05FA: case 0x05FB: - case 0x05FC: case 0x05FD: case 0x05FE: - case 0x065C: case 0x0674: case 0x06C0: case 0x08C4: - case 0x08E0: case 0x08E1: case 0x08E2: case 0x08E3: case 0x08E4: - case 0x08E5: case 0x08E6: case 0x08E7: case 0x08E8: case 0x08E9: - case 0x08EA: case 0x08EB: case 0x08EC: case 0x08ED: case 0x08EE: case 0x08EF: - case 0x0900: case 0x0908: case 0x0910: case 0x0918: case 0x0920: - case 0x042B: - return true; - default: - return false; - } - case EngineTypes::Fermi2D: - return method == 0x22F; - case EngineTypes::KeplerCompute: - return method == 0x1B || method == 0x2B; - case EngineTypes::KeplerMemory: - return method == 0x1B; - case EngineTypes::MaxwellDMA: - return method == 0xC0; - default: - return false; - } -} - -} // anonymous namespace - #ifdef _MSC_VER #include #endif @@ -247,7 +202,7 @@ void DmaPusher::CallMethod(u32 argument) const { }); } else { auto subchannel = subchannels[dma_state.subchannel]; - if (!IsMethodExecutable(dma_state.method, subchannel_type[dma_state.subchannel])) [[likely]] { + if (!subchannel->execution_mask[dma_state.method]) [[likely]] { subchannel->method_sink.emplace_back(dma_state.method, argument); return; } diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 619b2734f3..b0af784f7f 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -125,6 +125,73 @@ void Maxwell3D::InitializeRegisterDefaults() { shadow_state = regs; } +bool Maxwell3D::IsMethodExecutable(u32 method) { + if (method >= MacroRegistersStart) { + return true; + } + switch (method) { + case MAXWELL3D_REG_INDEX(draw.end): + case MAXWELL3D_REG_INDEX(draw.begin): + case MAXWELL3D_REG_INDEX(vertex_buffer.first): + case MAXWELL3D_REG_INDEX(vertex_buffer.count): + case MAXWELL3D_REG_INDEX(index_buffer.first): + case MAXWELL3D_REG_INDEX(index_buffer.count): + case MAXWELL3D_REG_INDEX(draw_inline_index): + case MAXWELL3D_REG_INDEX(index_buffer32_subsequent): + case MAXWELL3D_REG_INDEX(index_buffer16_subsequent): + case MAXWELL3D_REG_INDEX(index_buffer8_subsequent): + case MAXWELL3D_REG_INDEX(index_buffer32_first): + case MAXWELL3D_REG_INDEX(index_buffer16_first): + case MAXWELL3D_REG_INDEX(index_buffer8_first): + case MAXWELL3D_REG_INDEX(inline_index_2x16.even): + case MAXWELL3D_REG_INDEX(inline_index_4x8.index0): + case MAXWELL3D_REG_INDEX(vertex_array_instance_first): + case MAXWELL3D_REG_INDEX(vertex_array_instance_subsequent): + case MAXWELL3D_REG_INDEX(draw_texture.src_y0): + case MAXWELL3D_REG_INDEX(wait_for_idle): + case MAXWELL3D_REG_INDEX(shadow_ram_control): + case MAXWELL3D_REG_INDEX(load_mme.instruction_ptr): + case MAXWELL3D_REG_INDEX(load_mme.instruction): + case MAXWELL3D_REG_INDEX(load_mme.start_address): + case MAXWELL3D_REG_INDEX(falcon[4]): + case MAXWELL3D_REG_INDEX(const_buffer.buffer): + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 1: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 2: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 3: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 4: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 5: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 6: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 7: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 8: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 9: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 10: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 11: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 12: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 13: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 14: + case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 15: + case MAXWELL3D_REG_INDEX(bind_groups[0].raw_config): + case MAXWELL3D_REG_INDEX(bind_groups[1].raw_config): + case MAXWELL3D_REG_INDEX(bind_groups[2].raw_config): + case MAXWELL3D_REG_INDEX(bind_groups[3].raw_config): + case MAXWELL3D_REG_INDEX(bind_groups[4].raw_config): + case MAXWELL3D_REG_INDEX(topology_override): + case MAXWELL3D_REG_INDEX(clear_surface): + case MAXWELL3D_REG_INDEX(report_semaphore.query): + case MAXWELL3D_REG_INDEX(render_enable.mode): + case MAXWELL3D_REG_INDEX(clear_report_value): + case MAXWELL3D_REG_INDEX(sync_info): + case MAXWELL3D_REG_INDEX(launch_dma): + case MAXWELL3D_REG_INDEX(inline_data): + case MAXWELL3D_REG_INDEX(fragment_barrier): + case MAXWELL3D_REG_INDEX(invalidate_texture_data_cache): + case MAXWELL3D_REG_INDEX(tiled_cache_barrier): + return true; + default: + return false; + } +} + 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. diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 63b7019338..ae2e7a84c4 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -3187,6 +3187,8 @@ private: void RefreshParametersImpl(); + bool IsMethodExecutable(u32 method); + Core::System& system; MemoryManager& memory_manager;