diff options
| -rw-r--r-- | src/video_core/macro/macro_hle.cpp | 30 | ||||
| -rw-r--r-- | src/video_core/macro/macro_hle.h | 16 |
2 files changed, 19 insertions, 27 deletions
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 70ac7c620..3f743ce55 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp | |||
| @@ -5,12 +5,15 @@ | |||
| 5 | #include <array> | 5 | #include <array> |
| 6 | #include <vector> | 6 | #include <vector> |
| 7 | #include "video_core/engines/maxwell_3d.h" | 7 | #include "video_core/engines/maxwell_3d.h" |
| 8 | #include "video_core/macro/macro.h" | ||
| 8 | #include "video_core/macro/macro_hle.h" | 9 | #include "video_core/macro/macro_hle.h" |
| 9 | #include "video_core/rasterizer_interface.h" | 10 | #include "video_core/rasterizer_interface.h" |
| 10 | 11 | ||
| 11 | namespace Tegra { | 12 | namespace Tegra { |
| 12 | |||
| 13 | namespace { | 13 | namespace { |
| 14 | |||
| 15 | using HLEFunction = void (*)(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters); | ||
| 16 | |||
| 14 | // HLE'd functions | 17 | // HLE'd functions |
| 15 | void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) { | 18 | void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters) { |
| 16 | const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); | 19 | const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); |
| @@ -77,7 +80,6 @@ void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& | |||
| 77 | maxwell3d.CallMethodFromMME(0x8e5, 0x0); | 80 | maxwell3d.CallMethodFromMME(0x8e5, 0x0); |
| 78 | maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; | 81 | maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; |
| 79 | } | 82 | } |
| 80 | } // Anonymous namespace | ||
| 81 | 83 | ||
| 82 | constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{ | 84 | constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{ |
| 83 | {0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, | 85 | {0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, |
| @@ -85,6 +87,21 @@ constexpr std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{{ | |||
| 85 | {0x0217920100488FF7, &HLE_0217920100488FF7}, | 87 | {0x0217920100488FF7, &HLE_0217920100488FF7}, |
| 86 | }}; | 88 | }}; |
| 87 | 89 | ||
| 90 | class HLEMacroImpl final : public CachedMacro { | ||
| 91 | public: | ||
| 92 | explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_, HLEFunction func_) | ||
| 93 | : maxwell3d{maxwell3d_}, func{func_} {} | ||
| 94 | |||
| 95 | void Execute(const std::vector<u32>& parameters, u32 method) override { | ||
| 96 | func(maxwell3d, parameters); | ||
| 97 | } | ||
| 98 | |||
| 99 | private: | ||
| 100 | Engines::Maxwell3D& maxwell3d; | ||
| 101 | HLEFunction func; | ||
| 102 | }; | ||
| 103 | } // Anonymous namespace | ||
| 104 | |||
| 88 | HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} | 105 | HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} |
| 89 | HLEMacro::~HLEMacro() = default; | 106 | HLEMacro::~HLEMacro() = default; |
| 90 | 107 | ||
| @@ -97,13 +114,4 @@ std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) co | |||
| 97 | return std::make_unique<HLEMacroImpl>(maxwell3d, it->second); | 114 | return std::make_unique<HLEMacroImpl>(maxwell3d, it->second); |
| 98 | } | 115 | } |
| 99 | 116 | ||
| 100 | HLEMacroImpl::~HLEMacroImpl() = default; | ||
| 101 | |||
| 102 | HLEMacroImpl::HLEMacroImpl(Engines::Maxwell3D& maxwell3d_, HLEFunction func_) | ||
| 103 | : maxwell3d{maxwell3d_}, func{func_} {} | ||
| 104 | |||
| 105 | void HLEMacroImpl::Execute(const std::vector<u32>& parameters, u32 method) { | ||
| 106 | func(maxwell3d, parameters); | ||
| 107 | } | ||
| 108 | |||
| 109 | } // namespace Tegra | 117 | } // namespace Tegra |
diff --git a/src/video_core/macro/macro_hle.h b/src/video_core/macro/macro_hle.h index cb3bd1600..c0a12e793 100644 --- a/src/video_core/macro/macro_hle.h +++ b/src/video_core/macro/macro_hle.h | |||
| @@ -6,9 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <optional> | 8 | #include <optional> |
| 9 | #include <vector> | ||
| 10 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 11 | #include "video_core/macro/macro.h" | ||
| 12 | 10 | ||
| 13 | namespace Tegra { | 11 | namespace Tegra { |
| 14 | 12 | ||
| @@ -16,8 +14,6 @@ namespace Engines { | |||
| 16 | class Maxwell3D; | 14 | class Maxwell3D; |
| 17 | } | 15 | } |
| 18 | 16 | ||
| 19 | using HLEFunction = void (*)(Engines::Maxwell3D& maxwell3d, const std::vector<u32>& parameters); | ||
| 20 | |||
| 21 | class HLEMacro { | 17 | class HLEMacro { |
| 22 | public: | 18 | public: |
| 23 | explicit HLEMacro(Engines::Maxwell3D& maxwell3d_); | 19 | explicit HLEMacro(Engines::Maxwell3D& maxwell3d_); |
| @@ -29,16 +25,4 @@ private: | |||
| 29 | Engines::Maxwell3D& maxwell3d; | 25 | Engines::Maxwell3D& maxwell3d; |
| 30 | }; | 26 | }; |
| 31 | 27 | ||
| 32 | class HLEMacroImpl : public CachedMacro { | ||
| 33 | public: | ||
| 34 | explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d, HLEFunction func); | ||
| 35 | ~HLEMacroImpl(); | ||
| 36 | |||
| 37 | void Execute(const std::vector<u32>& parameters, u32 method) override; | ||
| 38 | |||
| 39 | private: | ||
| 40 | Engines::Maxwell3D& maxwell3d; | ||
| 41 | HLEFunction func; | ||
| 42 | }; | ||
| 43 | |||
| 44 | } // namespace Tegra | 28 | } // namespace Tegra |