diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/engine_interface.h | 21 | ||||
| -rw-r--r-- | src/video_core/engines/fermi_2d.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/engines/fermi_2d.h | 7 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.h | 7 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_memory.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_memory.h | 7 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 28 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 9 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.h | 7 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/macro_interpreter.cpp | 2 |
13 files changed, 82 insertions, 62 deletions
diff --git a/src/video_core/engines/engine_interface.h b/src/video_core/engines/engine_interface.h new file mode 100644 index 000000000..c8f20408d --- /dev/null +++ b/src/video_core/engines/engine_interface.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | // Copyright 2020 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <type_traits> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | |||
| 10 | namespace Tegra::Engines { | ||
| 11 | |||
| 12 | class EngineInterface { | ||
| 13 | public: | ||
| 14 | /// Write the value to the register identified by method. | ||
| 15 | virtual void CallMethod(u32 method, u32 method_argument, bool is_last_call) = 0; | ||
| 16 | |||
| 17 | /// Write multiple values to the register identified by method. | ||
| 18 | virtual void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) = 0; | ||
| 19 | }; | ||
| 20 | |||
| 21 | } | ||
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index 8a47614d2..ff10ff40d 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -12,13 +12,13 @@ namespace Tegra::Engines { | |||
| 12 | 12 | ||
| 13 | Fermi2D::Fermi2D(VideoCore::RasterizerInterface& rasterizer) : rasterizer{rasterizer} {} | 13 | Fermi2D::Fermi2D(VideoCore::RasterizerInterface& rasterizer) : rasterizer{rasterizer} {} |
| 14 | 14 | ||
| 15 | void Fermi2D::CallMethod(const GPU::MethodCall& method_call) { | 15 | void Fermi2D::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 16 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 16 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 17 | "Invalid Fermi2D register, increase the size of the Regs structure"); | 17 | "Invalid Fermi2D register, increase the size of the Regs structure"); |
| 18 | 18 | ||
| 19 | regs.reg_array[method_call.method] = method_call.argument; | 19 | regs.reg_array[method] = method_argument; |
| 20 | 20 | ||
| 21 | switch (method_call.method) { | 21 | switch (method) { |
| 22 | // Trigger the surface copy on the last register write. This is blit_src_y, but this is 64-bit, | 22 | // Trigger the surface copy on the last register write. This is blit_src_y, but this is 64-bit, |
| 23 | // so trigger on the second 32-bit write. | 23 | // so trigger on the second 32-bit write. |
| 24 | case FERMI2D_REG_INDEX(blit_src_y) + 1: { | 24 | case FERMI2D_REG_INDEX(blit_src_y) + 1: { |
| @@ -30,7 +30,7 @@ void Fermi2D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 30 | 30 | ||
| 31 | void Fermi2D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | 31 | void Fermi2D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { |
| 32 | for (std::size_t i = 0; i < amount; i++) { | 32 | for (std::size_t i = 0; i < amount; i++) { |
| 33 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 33 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h index 939a5966d..77c2a0e39 100644 --- a/src/video_core/engines/fermi_2d.h +++ b/src/video_core/engines/fermi_2d.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/common_funcs.h" | 10 | #include "common/common_funcs.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/math_util.h" | 12 | #include "common/math_util.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 13 | #include "video_core/gpu.h" | 14 | #include "video_core/gpu.h" |
| 14 | 15 | ||
| 15 | namespace Tegra { | 16 | namespace Tegra { |
| @@ -31,16 +32,16 @@ namespace Tegra::Engines { | |||
| 31 | #define FERMI2D_REG_INDEX(field_name) \ | 32 | #define FERMI2D_REG_INDEX(field_name) \ |
| 32 | (offsetof(Tegra::Engines::Fermi2D::Regs, field_name) / sizeof(u32)) | 33 | (offsetof(Tegra::Engines::Fermi2D::Regs, field_name) / sizeof(u32)) |
| 33 | 34 | ||
| 34 | class Fermi2D final { | 35 | class Fermi2D final : public EngineInterface { |
| 35 | public: | 36 | public: |
| 36 | explicit Fermi2D(VideoCore::RasterizerInterface& rasterizer); | 37 | explicit Fermi2D(VideoCore::RasterizerInterface& rasterizer); |
| 37 | ~Fermi2D() = default; | 38 | ~Fermi2D() = default; |
| 38 | 39 | ||
| 39 | /// Write the value to the register identified by method. | 40 | /// Write the value to the register identified by method. |
| 40 | void CallMethod(const GPU::MethodCall& method_call); | 41 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 41 | 42 | ||
| 42 | /// Write multiple values to the register identified by method. | 43 | /// Write multiple values to the register identified by method. |
| 43 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 44 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) override; |
| 44 | 45 | ||
| 45 | enum class Origin : u32 { | 46 | enum class Origin : u32 { |
| 46 | Center = 0, | 47 | Center = 0, |
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index 00a12175f..88717b431 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp | |||
| @@ -24,20 +24,19 @@ KeplerCompute::KeplerCompute(Core::System& system, VideoCore::RasterizerInterfac | |||
| 24 | 24 | ||
| 25 | KeplerCompute::~KeplerCompute() = default; | 25 | KeplerCompute::~KeplerCompute() = default; |
| 26 | 26 | ||
| 27 | void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) { | 27 | void KeplerCompute::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 28 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 28 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 29 | "Invalid KeplerCompute register, increase the size of the Regs structure"); | 29 | "Invalid KeplerCompute register, increase the size of the Regs structure"); |
| 30 | 30 | ||
| 31 | regs.reg_array[method_call.method] = method_call.argument; | 31 | regs.reg_array[method] = method_argument; |
| 32 | 32 | ||
| 33 | switch (method_call.method) { | 33 | switch (method) { |
| 34 | case KEPLER_COMPUTE_REG_INDEX(exec_upload): { | 34 | case KEPLER_COMPUTE_REG_INDEX(exec_upload): { |
| 35 | upload_state.ProcessExec(regs.exec_upload.linear != 0); | 35 | upload_state.ProcessExec(regs.exec_upload.linear != 0); |
| 36 | break; | 36 | break; |
| 37 | } | 37 | } |
| 38 | case KEPLER_COMPUTE_REG_INDEX(data_upload): { | 38 | case KEPLER_COMPUTE_REG_INDEX(data_upload): { |
| 39 | const bool is_last_call = method_call.IsLastCall(); | 39 | upload_state.ProcessData(method_argument, is_last_call); |
| 40 | upload_state.ProcessData(method_call.argument, is_last_call); | ||
| 41 | if (is_last_call) { | 40 | if (is_last_call) { |
| 42 | system.GPU().Maxwell3D().OnMemoryWrite(); | 41 | system.GPU().Maxwell3D().OnMemoryWrite(); |
| 43 | } | 42 | } |
| @@ -54,7 +53,7 @@ void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) { | |||
| 54 | void KeplerCompute::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 53 | void KeplerCompute::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 55 | u32 methods_pending) { | 54 | u32 methods_pending) { |
| 56 | for (std::size_t i = 0; i < amount; i++) { | 55 | for (std::size_t i = 0; i < amount; i++) { |
| 57 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 56 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 58 | } | 57 | } |
| 59 | } | 58 | } |
| 60 | 59 | ||
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h index fe55fdfd0..abeb41e84 100644 --- a/src/video_core/engines/kepler_compute.h +++ b/src/video_core/engines/kepler_compute.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/const_buffer_engine_interface.h" | 13 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 14 | #include "video_core/engines/engine_interface.h" | ||
| 14 | #include "video_core/engines/engine_upload.h" | 15 | #include "video_core/engines/engine_upload.h" |
| 15 | #include "video_core/engines/shader_type.h" | 16 | #include "video_core/engines/shader_type.h" |
| 16 | #include "video_core/gpu.h" | 17 | #include "video_core/gpu.h" |
| @@ -39,7 +40,7 @@ namespace Tegra::Engines { | |||
| 39 | #define KEPLER_COMPUTE_REG_INDEX(field_name) \ | 40 | #define KEPLER_COMPUTE_REG_INDEX(field_name) \ |
| 40 | (offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32)) | 41 | (offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32)) |
| 41 | 42 | ||
| 42 | class KeplerCompute final : public ConstBufferEngineInterface { | 43 | class KeplerCompute final : public ConstBufferEngineInterface, public EngineInterface { |
| 43 | public: | 44 | public: |
| 44 | explicit KeplerCompute(Core::System& system, VideoCore::RasterizerInterface& rasterizer, | 45 | explicit KeplerCompute(Core::System& system, VideoCore::RasterizerInterface& rasterizer, |
| 45 | MemoryManager& memory_manager); | 46 | MemoryManager& memory_manager); |
| @@ -200,10 +201,10 @@ public: | |||
| 200 | "KeplerCompute LaunchParams has wrong size"); | 201 | "KeplerCompute LaunchParams has wrong size"); |
| 201 | 202 | ||
| 202 | /// Write the value to the register identified by method. | 203 | /// Write the value to the register identified by method. |
| 203 | void CallMethod(const GPU::MethodCall& method_call); | 204 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 204 | 205 | ||
| 205 | /// Write multiple values to the register identified by method. | 206 | /// Write multiple values to the register identified by method. |
| 206 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 207 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) override; |
| 207 | 208 | ||
| 208 | Texture::FullTextureInfo GetTexture(std::size_t offset) const; | 209 | Texture::FullTextureInfo GetTexture(std::size_t offset) const; |
| 209 | 210 | ||
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp index 586ff15dc..dc71b2eec 100644 --- a/src/video_core/engines/kepler_memory.cpp +++ b/src/video_core/engines/kepler_memory.cpp | |||
| @@ -19,20 +19,19 @@ KeplerMemory::KeplerMemory(Core::System& system, MemoryManager& memory_manager) | |||
| 19 | 19 | ||
| 20 | KeplerMemory::~KeplerMemory() = default; | 20 | KeplerMemory::~KeplerMemory() = default; |
| 21 | 21 | ||
| 22 | void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) { | 22 | void KeplerMemory::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 23 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 23 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 24 | "Invalid KeplerMemory register, increase the size of the Regs structure"); | 24 | "Invalid KeplerMemory register, increase the size of the Regs structure"); |
| 25 | 25 | ||
| 26 | regs.reg_array[method_call.method] = method_call.argument; | 26 | regs.reg_array[method] = method_argument; |
| 27 | 27 | ||
| 28 | switch (method_call.method) { | 28 | switch (method) { |
| 29 | case KEPLERMEMORY_REG_INDEX(exec): { | 29 | case KEPLERMEMORY_REG_INDEX(exec): { |
| 30 | upload_state.ProcessExec(regs.exec.linear != 0); | 30 | upload_state.ProcessExec(regs.exec.linear != 0); |
| 31 | break; | 31 | break; |
| 32 | } | 32 | } |
| 33 | case KEPLERMEMORY_REG_INDEX(data): { | 33 | case KEPLERMEMORY_REG_INDEX(data): { |
| 34 | const bool is_last_call = method_call.IsLastCall(); | 34 | upload_state.ProcessData(method_argument, is_last_call); |
| 35 | upload_state.ProcessData(method_call.argument, is_last_call); | ||
| 36 | if (is_last_call) { | 35 | if (is_last_call) { |
| 37 | system.GPU().Maxwell3D().OnMemoryWrite(); | 36 | system.GPU().Maxwell3D().OnMemoryWrite(); |
| 38 | } | 37 | } |
| @@ -44,7 +43,7 @@ void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) { | |||
| 44 | void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 43 | void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 45 | u32 methods_pending) { | 44 | u32 methods_pending) { |
| 46 | for (std::size_t i = 0; i < amount; i++) { | 45 | for (std::size_t i = 0; i < amount; i++) { |
| 47 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 46 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 48 | } | 47 | } |
| 49 | } | 48 | } |
| 50 | 49 | ||
diff --git a/src/video_core/engines/kepler_memory.h b/src/video_core/engines/kepler_memory.h index bb26fb030..193caf206 100644 --- a/src/video_core/engines/kepler_memory.h +++ b/src/video_core/engines/kepler_memory.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 13 | #include "video_core/engines/engine_upload.h" | 14 | #include "video_core/engines/engine_upload.h" |
| 14 | #include "video_core/gpu.h" | 15 | #include "video_core/gpu.h" |
| 15 | 16 | ||
| @@ -32,16 +33,16 @@ namespace Tegra::Engines { | |||
| 32 | #define KEPLERMEMORY_REG_INDEX(field_name) \ | 33 | #define KEPLERMEMORY_REG_INDEX(field_name) \ |
| 33 | (offsetof(Tegra::Engines::KeplerMemory::Regs, field_name) / sizeof(u32)) | 34 | (offsetof(Tegra::Engines::KeplerMemory::Regs, field_name) / sizeof(u32)) |
| 34 | 35 | ||
| 35 | class KeplerMemory final { | 36 | class KeplerMemory final : public EngineInterface { |
| 36 | public: | 37 | public: |
| 37 | KeplerMemory(Core::System& system, MemoryManager& memory_manager); | 38 | KeplerMemory(Core::System& system, MemoryManager& memory_manager); |
| 38 | ~KeplerMemory(); | 39 | ~KeplerMemory(); |
| 39 | 40 | ||
| 40 | /// Write the value to the register identified by method. | 41 | /// Write the value to the register identified by method. |
| 41 | void CallMethod(const GPU::MethodCall& method_call); | 42 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 42 | 43 | ||
| 43 | /// Write multiple values to the register identified by method. | 44 | /// Write multiple values to the register identified by method. |
| 44 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 45 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) override; |
| 45 | 46 | ||
| 46 | struct Regs { | 47 | struct Regs { |
| 47 | static constexpr size_t NUM_REGS = 0x7F; | 48 | static constexpr size_t NUM_REGS = 0x7F; |
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 | |||
| 125 | } | 125 | } |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | 128 | void Maxwell3D::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 129 | const u32 method = method_call.method; | ||
| 130 | |||
| 131 | if (method == cb_data_state.current) { | 129 | if (method == cb_data_state.current) { |
| 132 | regs.reg_array[method] = method_call.argument; | 130 | regs.reg_array[method] = method_argument; |
| 133 | ProcessCBData(method_call.argument); | 131 | ProcessCBData(method_argument); |
| 134 | return; | 132 | return; |
| 135 | } else if (cb_data_state.current != null_cb_data) { | 133 | } else if (cb_data_state.current != null_cb_data) { |
| 136 | FinishCBData(); | 134 | FinishCBData(); |
| @@ -153,10 +151,10 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 153 | executing_macro = method; | 151 | executing_macro = method; |
| 154 | } | 152 | } |
| 155 | 153 | ||
| 156 | macro_params.push_back(method_call.argument); | 154 | macro_params.push_back(method_argument); |
| 157 | 155 | ||
| 158 | // Call the macro when there are no more parameters in the command buffer | 156 | // Call the macro when there are no more parameters in the command buffer |
| 159 | if (method_call.IsLastCall()) { | 157 | if (is_last_call) { |
| 160 | CallMacroMethod(executing_macro, macro_params.size(), macro_params.data()); | 158 | CallMacroMethod(executing_macro, macro_params.size(), macro_params.data()); |
| 161 | macro_params.clear(); | 159 | macro_params.clear(); |
| 162 | } | 160 | } |
| @@ -166,7 +164,7 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 166 | ASSERT_MSG(method < Regs::NUM_REGS, | 164 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 167 | "Invalid Maxwell3D register, increase the size of the Regs structure"); | 165 | "Invalid Maxwell3D register, increase the size of the Regs structure"); |
| 168 | 166 | ||
| 169 | u32 arg = method_call.argument; | 167 | u32 arg = method_argument; |
| 170 | // Keep track of the register value in shadow_state when requested. | 168 | // Keep track of the register value in shadow_state when requested. |
| 171 | if (shadow_state.shadow_ram_control == Regs::ShadowRamControl::Track || | 169 | if (shadow_state.shadow_ram_control == Regs::ShadowRamControl::Track || |
| 172 | shadow_state.shadow_ram_control == Regs::ShadowRamControl::TrackWithFilter) { | 170 | shadow_state.shadow_ram_control == Regs::ShadowRamControl::TrackWithFilter) { |
| @@ -185,7 +183,7 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 185 | 183 | ||
| 186 | switch (method) { | 184 | switch (method) { |
| 187 | case MAXWELL3D_REG_INDEX(shadow_ram_control): { | 185 | case MAXWELL3D_REG_INDEX(shadow_ram_control): { |
| 188 | shadow_state.shadow_ram_control = static_cast<Regs::ShadowRamControl>(method_call.argument); | 186 | shadow_state.shadow_ram_control = static_cast<Regs::ShadowRamControl>(method_argument); |
| 189 | break; | 187 | break; |
| 190 | } | 188 | } |
| 191 | case MAXWELL3D_REG_INDEX(macros.data): { | 189 | case MAXWELL3D_REG_INDEX(macros.data): { |
| @@ -268,7 +266,6 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 268 | break; | 266 | break; |
| 269 | } | 267 | } |
| 270 | case MAXWELL3D_REG_INDEX(data_upload): { | 268 | case MAXWELL3D_REG_INDEX(data_upload): { |
| 271 | const bool is_last_call = method_call.IsLastCall(); | ||
| 272 | upload_state.ProcessData(arg, is_last_call); | 269 | upload_state.ProcessData(arg, is_last_call); |
| 273 | if (is_last_call) { | 270 | if (is_last_call) { |
| 274 | OnMemoryWrite(); | 271 | OnMemoryWrite(); |
| @@ -326,7 +323,7 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | |||
| 326 | } | 323 | } |
| 327 | default: { | 324 | default: { |
| 328 | for (std::size_t i = 0; i < amount; i++) { | 325 | for (std::size_t i = 0; i < amount; i++) { |
| 329 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 326 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 330 | } | 327 | } |
| 331 | } | 328 | } |
| 332 | } | 329 | } |
| @@ -356,16 +353,15 @@ void Maxwell3D::StepInstance(const MMEDrawMode expected_mode, const u32 count) { | |||
| 356 | StepInstance(expected_mode, count); | 353 | StepInstance(expected_mode, count); |
| 357 | } | 354 | } |
| 358 | 355 | ||
| 359 | void Maxwell3D::CallMethodFromMME(const GPU::MethodCall& method_call) { | 356 | void Maxwell3D::CallMethodFromMME(u32 method, u32 method_argument) { |
| 360 | const u32 method = method_call.method; | ||
| 361 | if (mme_inline[method]) { | 357 | if (mme_inline[method]) { |
| 362 | regs.reg_array[method] = method_call.argument; | 358 | regs.reg_array[method] = method_argument; |
| 363 | if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count) || | 359 | if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count) || |
| 364 | method == MAXWELL3D_REG_INDEX(index_array.count)) { | 360 | method == MAXWELL3D_REG_INDEX(index_array.count)) { |
| 365 | const MMEDrawMode expected_mode = method == MAXWELL3D_REG_INDEX(vertex_buffer.count) | 361 | const MMEDrawMode expected_mode = method == MAXWELL3D_REG_INDEX(vertex_buffer.count) |
| 366 | ? MMEDrawMode::Array | 362 | ? MMEDrawMode::Array |
| 367 | : MMEDrawMode::Indexed; | 363 | : MMEDrawMode::Indexed; |
| 368 | StepInstance(expected_mode, method_call.argument); | 364 | StepInstance(expected_mode, method_argument); |
| 369 | } else if (method == MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)) { | 365 | } else if (method == MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)) { |
| 370 | mme_draw.instance_mode = | 366 | mme_draw.instance_mode = |
| 371 | (regs.draw.instance_next != 0) || (regs.draw.instance_cont != 0); | 367 | (regs.draw.instance_next != 0) || (regs.draw.instance_cont != 0); |
| @@ -377,7 +373,7 @@ void Maxwell3D::CallMethodFromMME(const GPU::MethodCall& method_call) { | |||
| 377 | if (mme_draw.current_mode != MMEDrawMode::Undefined) { | 373 | if (mme_draw.current_mode != MMEDrawMode::Undefined) { |
| 378 | FlushMMEInlineDraw(); | 374 | FlushMMEInlineDraw(); |
| 379 | } | 375 | } |
| 380 | CallMethod(method_call); | 376 | CallMethod(method, method_argument, true); |
| 381 | } | 377 | } |
| 382 | } | 378 | } |
| 383 | 379 | ||
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 3dfba8197..3d1e49c7c 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include "common/math_util.h" | 19 | #include "common/math_util.h" |
| 20 | #include "video_core/engines/const_buffer_engine_interface.h" | 20 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 21 | #include "video_core/engines/const_buffer_info.h" | 21 | #include "video_core/engines/const_buffer_info.h" |
| 22 | #include "video_core/engines/engine_interface.h" | ||
| 22 | #include "video_core/engines/engine_upload.h" | 23 | #include "video_core/engines/engine_upload.h" |
| 23 | #include "video_core/engines/shader_type.h" | 24 | #include "video_core/engines/shader_type.h" |
| 24 | #include "video_core/gpu.h" | 25 | #include "video_core/gpu.h" |
| @@ -48,7 +49,7 @@ namespace Tegra::Engines { | |||
| 48 | #define MAXWELL3D_REG_INDEX(field_name) \ | 49 | #define MAXWELL3D_REG_INDEX(field_name) \ |
| 49 | (offsetof(Tegra::Engines::Maxwell3D::Regs, field_name) / sizeof(u32)) | 50 | (offsetof(Tegra::Engines::Maxwell3D::Regs, field_name) / sizeof(u32)) |
| 50 | 51 | ||
| 51 | class Maxwell3D final : public ConstBufferEngineInterface { | 52 | class Maxwell3D final : public ConstBufferEngineInterface, public EngineInterface { |
| 52 | public: | 53 | public: |
| 53 | explicit Maxwell3D(Core::System& system, VideoCore::RasterizerInterface& rasterizer, | 54 | explicit Maxwell3D(Core::System& system, VideoCore::RasterizerInterface& rasterizer, |
| 54 | MemoryManager& memory_manager); | 55 | MemoryManager& memory_manager); |
| @@ -1357,13 +1358,13 @@ public: | |||
| 1357 | u32 GetRegisterValue(u32 method) const; | 1358 | u32 GetRegisterValue(u32 method) const; |
| 1358 | 1359 | ||
| 1359 | /// Write the value to the register identified by method. | 1360 | /// Write the value to the register identified by method. |
| 1360 | void CallMethod(const GPU::MethodCall& method_call); | 1361 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 1361 | 1362 | ||
| 1362 | /// Write multiple values to the register identified by method. | 1363 | /// Write multiple values to the register identified by method. |
| 1363 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 1364 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) override; |
| 1364 | 1365 | ||
| 1365 | /// Write the value to the register identified by method. | 1366 | /// Write the value to the register identified by method. |
| 1366 | void CallMethodFromMME(const GPU::MethodCall& method_call); | 1367 | void CallMethodFromMME(u32 method, u32 method_argument); |
| 1367 | 1368 | ||
| 1368 | void FlushMMEInlineDraw(); | 1369 | void FlushMMEInlineDraw(); |
| 1369 | 1370 | ||
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 6630005b0..22ca730bc 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -17,16 +17,16 @@ namespace Tegra::Engines { | |||
| 17 | MaxwellDMA::MaxwellDMA(Core::System& system, MemoryManager& memory_manager) | 17 | MaxwellDMA::MaxwellDMA(Core::System& system, MemoryManager& memory_manager) |
| 18 | : system{system}, memory_manager{memory_manager} {} | 18 | : system{system}, memory_manager{memory_manager} {} |
| 19 | 19 | ||
| 20 | void MaxwellDMA::CallMethod(const GPU::MethodCall& method_call) { | 20 | void MaxwellDMA::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 21 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 21 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 22 | "Invalid MaxwellDMA register, increase the size of the Regs structure"); | 22 | "Invalid MaxwellDMA register, increase the size of the Regs structure"); |
| 23 | 23 | ||
| 24 | regs.reg_array[method_call.method] = method_call.argument; | 24 | regs.reg_array[method] = method_argument; |
| 25 | 25 | ||
| 26 | #define MAXWELLDMA_REG_INDEX(field_name) \ | 26 | #define MAXWELLDMA_REG_INDEX(field_name) \ |
| 27 | (offsetof(Tegra::Engines::MaxwellDMA::Regs, field_name) / sizeof(u32)) | 27 | (offsetof(Tegra::Engines::MaxwellDMA::Regs, field_name) / sizeof(u32)) |
| 28 | 28 | ||
| 29 | switch (method_call.method) { | 29 | switch (method) { |
| 30 | case MAXWELLDMA_REG_INDEX(exec): { | 30 | case MAXWELLDMA_REG_INDEX(exec): { |
| 31 | HandleCopy(); | 31 | HandleCopy(); |
| 32 | break; | 32 | break; |
| @@ -39,7 +39,7 @@ void MaxwellDMA::CallMethod(const GPU::MethodCall& method_call) { | |||
| 39 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 39 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 40 | u32 methods_pending) { | 40 | u32 methods_pending) { |
| 41 | for (std::size_t i = 0; i < amount; i++) { | 41 | for (std::size_t i = 0; i < amount; i++) { |
| 42 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 42 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| 45 | 45 | ||
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index c43ed8194..65739f2e3 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 13 | #include "video_core/gpu.h" | 14 | #include "video_core/gpu.h" |
| 14 | 15 | ||
| 15 | namespace Core { | 16 | namespace Core { |
| @@ -27,16 +28,16 @@ namespace Tegra::Engines { | |||
| 27 | * https://github.com/envytools/envytools/blob/master/rnndb/fifo/gk104_copy.xml | 28 | * https://github.com/envytools/envytools/blob/master/rnndb/fifo/gk104_copy.xml |
| 28 | */ | 29 | */ |
| 29 | 30 | ||
| 30 | class MaxwellDMA final { | 31 | class MaxwellDMA final : public EngineInterface { |
| 31 | public: | 32 | public: |
| 32 | explicit MaxwellDMA(Core::System& system, MemoryManager& memory_manager); | 33 | explicit MaxwellDMA(Core::System& system, MemoryManager& memory_manager); |
| 33 | ~MaxwellDMA() = default; | 34 | ~MaxwellDMA() = default; |
| 34 | 35 | ||
| 35 | /// Write the value to the register identified by method. | 36 | /// Write the value to the register identified by method. |
| 36 | void CallMethod(const GPU::MethodCall& method_call); | 37 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 37 | 38 | ||
| 38 | /// Write multiple values to the register identified by method. | 39 | /// Write multiple values to the register identified by method. |
| 39 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 40 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) override; |
| 40 | 41 | ||
| 41 | struct Regs { | 42 | struct Regs { |
| 42 | static constexpr std::size_t NUM_REGS = 0x1D6; | 43 | static constexpr std::size_t NUM_REGS = 0x1D6; |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index b87fd873d..4868437c1 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -299,19 +299,19 @@ void GPU::CallEngineMethod(const MethodCall& method_call) { | |||
| 299 | 299 | ||
| 300 | switch (engine) { | 300 | switch (engine) { |
| 301 | case EngineID::FERMI_TWOD_A: | 301 | case EngineID::FERMI_TWOD_A: |
| 302 | fermi_2d->CallMethod(method_call); | 302 | fermi_2d->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 303 | break; | 303 | break; |
| 304 | case EngineID::MAXWELL_B: | 304 | case EngineID::MAXWELL_B: |
| 305 | maxwell_3d->CallMethod(method_call); | 305 | maxwell_3d->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 306 | break; | 306 | break; |
| 307 | case EngineID::KEPLER_COMPUTE_B: | 307 | case EngineID::KEPLER_COMPUTE_B: |
| 308 | kepler_compute->CallMethod(method_call); | 308 | kepler_compute->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 309 | break; | 309 | break; |
| 310 | case EngineID::MAXWELL_DMA_COPY_A: | 310 | case EngineID::MAXWELL_DMA_COPY_A: |
| 311 | maxwell_dma->CallMethod(method_call); | 311 | maxwell_dma->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 312 | break; | 312 | break; |
| 313 | case EngineID::KEPLER_INLINE_TO_MEMORY_B: | 313 | case EngineID::KEPLER_INLINE_TO_MEMORY_B: |
| 314 | kepler_memory->CallMethod(method_call); | 314 | kepler_memory->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 315 | break; | 315 | break; |
| 316 | default: | 316 | default: |
| 317 | UNIMPLEMENTED_MSG("Unimplemented engine"); | 317 | UNIMPLEMENTED_MSG("Unimplemented engine"); |
diff --git a/src/video_core/macro_interpreter.cpp b/src/video_core/macro_interpreter.cpp index 42031d80a..947364928 100644 --- a/src/video_core/macro_interpreter.cpp +++ b/src/video_core/macro_interpreter.cpp | |||
| @@ -328,7 +328,7 @@ void MacroInterpreter::SetMethodAddress(u32 address) { | |||
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | void MacroInterpreter::Send(u32 value) { | 330 | void MacroInterpreter::Send(u32 value) { |
| 331 | maxwell3d.CallMethodFromMME({method_address.address, value}); | 331 | maxwell3d.CallMethodFromMME(method_address.address, value); |
| 332 | // Increment the method address by the method increment. | 332 | // Increment the method address by the method increment. |
| 333 | method_address.address.Assign(method_address.address.Value() + | 333 | method_address.address.Assign(method_address.address.Value() + |
| 334 | method_address.increment.Value()); | 334 | method_address.increment.Value()); |