From 90e5694230c0b5a946f7cec6f8083476016a42be Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 27 Apr 2020 21:47:58 -0400 Subject: VideoCore/Engines: Refactor Engines CallMethod. --- src/video_core/engines/maxwell_3d.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/video_core/engines/maxwell_3d.cpp') diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 39e3b66a2..264edaa02 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -125,12 +125,10 @@ void Maxwell3D::CallMacroMethod(u32 method, std::size_t num_parameters, const u3 } } -void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { - const u32 method = method_call.method; - +void Maxwell3D::CallMethod(u32 method, u32 method_argument, bool is_last_call) { if (method == cb_data_state.current) { - regs.reg_array[method] = method_call.argument; - ProcessCBData(method_call.argument); + regs.reg_array[method] = method_argument; + ProcessCBData(method_argument); return; } else if (cb_data_state.current != null_cb_data) { FinishCBData(); @@ -153,10 +151,10 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { executing_macro = method; } - macro_params.push_back(method_call.argument); + macro_params.push_back(method_argument); // Call the macro when there are no more parameters in the command buffer - if (method_call.IsLastCall()) { + if (is_last_call) { CallMacroMethod(executing_macro, macro_params.size(), macro_params.data()); macro_params.clear(); } @@ -166,7 +164,7 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { ASSERT_MSG(method < Regs::NUM_REGS, "Invalid Maxwell3D register, increase the size of the Regs structure"); - u32 arg = method_call.argument; + u32 arg = method_argument; // Keep track of the register value in shadow_state when requested. if (shadow_state.shadow_ram_control == Regs::ShadowRamControl::Track || shadow_state.shadow_ram_control == Regs::ShadowRamControl::TrackWithFilter) { @@ -185,7 +183,7 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { switch (method) { case MAXWELL3D_REG_INDEX(shadow_ram_control): { - shadow_state.shadow_ram_control = static_cast(method_call.argument); + shadow_state.shadow_ram_control = static_cast(method_argument); break; } case MAXWELL3D_REG_INDEX(macros.data): { @@ -268,7 +266,6 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { break; } case MAXWELL3D_REG_INDEX(data_upload): { - const bool is_last_call = method_call.IsLastCall(); upload_state.ProcessData(arg, is_last_call); if (is_last_call) { OnMemoryWrite(); @@ -326,7 +323,7 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, } default: { for (std::size_t i = 0; i < amount; i++) { - CallMethod({method, base_start[i], 0, methods_pending - static_cast(i)}); + CallMethod(method, base_start[i], methods_pending - static_cast(i) <= 1); } } } @@ -356,16 +353,15 @@ void Maxwell3D::StepInstance(const MMEDrawMode expected_mode, const u32 count) { StepInstance(expected_mode, count); } -void Maxwell3D::CallMethodFromMME(const GPU::MethodCall& method_call) { - const u32 method = method_call.method; +void Maxwell3D::CallMethodFromMME(u32 method, u32 method_argument) { if (mme_inline[method]) { - regs.reg_array[method] = method_call.argument; + regs.reg_array[method] = method_argument; if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count) || method == MAXWELL3D_REG_INDEX(index_array.count)) { const MMEDrawMode expected_mode = method == MAXWELL3D_REG_INDEX(vertex_buffer.count) ? MMEDrawMode::Array : MMEDrawMode::Indexed; - StepInstance(expected_mode, method_call.argument); + StepInstance(expected_mode, method_argument); } else if (method == MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)) { mme_draw.instance_mode = (regs.draw.instance_next != 0) || (regs.draw.instance_cont != 0); @@ -377,7 +373,7 @@ void Maxwell3D::CallMethodFromMME(const GPU::MethodCall& method_call) { if (mme_draw.current_mode != MMEDrawMode::Undefined) { FlushMMEInlineDraw(); } - CallMethod(method_call); + CallMethod(method, method_argument, true); } } -- cgit v1.2.3