diff options
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 4 | ||||
| -rw-r--r-- | src/video_core/macro/macro.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/macro/macro.h | 2 | ||||
| -rw-r--r-- | src/video_core/macro/macro_hle.cpp | 20 | ||||
| -rw-r--r-- | src/video_core/macro/macro_hle.h | 2 |
5 files changed, 17 insertions, 13 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 5926c4d2d..ef1618990 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1422,6 +1422,10 @@ public: | |||
| 1422 | return rasterizer; | 1422 | return rasterizer; |
| 1423 | } | 1423 | } |
| 1424 | 1424 | ||
| 1425 | const VideoCore::RasterizerInterface& GetRasterizer() const { | ||
| 1426 | return rasterizer; | ||
| 1427 | } | ||
| 1428 | |||
| 1425 | /// Notify a memory write has happened. | 1429 | /// Notify a memory write has happened. |
| 1426 | void OnMemoryWrite() { | 1430 | void OnMemoryWrite() { |
| 1427 | dirty.flags |= dirty.on_write_stores; | 1431 | dirty.flags |= dirty.on_write_stores; |
diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp index c8aa2534a..ef7dad349 100644 --- a/src/video_core/macro/macro.cpp +++ b/src/video_core/macro/macro.cpp | |||
| @@ -17,7 +17,7 @@ namespace Tegra { | |||
| 17 | MacroEngine::MacroEngine(Engines::Maxwell3D& maxwell3d) | 17 | MacroEngine::MacroEngine(Engines::Maxwell3D& maxwell3d) |
| 18 | : hle_macros{std::make_unique<Tegra::HLEMacro>(maxwell3d)} {} | 18 | : hle_macros{std::make_unique<Tegra::HLEMacro>(maxwell3d)} {} |
| 19 | 19 | ||
| 20 | MacroEngine::~MacroEngine() {} | 20 | MacroEngine::~MacroEngine() = default; |
| 21 | 21 | ||
| 22 | void MacroEngine::AddCode(u32 method, u32 data) { | 22 | void MacroEngine::AddCode(u32 method, u32 data) { |
| 23 | uploaded_macro_code[method].push_back(data); | 23 | uploaded_macro_code[method].push_back(data); |
diff --git a/src/video_core/macro/macro.h b/src/video_core/macro/macro.h index 5fa8023af..4d00b84b0 100644 --- a/src/video_core/macro/macro.h +++ b/src/video_core/macro/macro.h | |||
| @@ -111,7 +111,7 @@ public: | |||
| 111 | 111 | ||
| 112 | class MacroEngine { | 112 | class MacroEngine { |
| 113 | public: | 113 | public: |
| 114 | MacroEngine(Engines::Maxwell3D& maxwell3d); | 114 | explicit MacroEngine(Engines::Maxwell3D& maxwell3d); |
| 115 | virtual ~MacroEngine(); | 115 | virtual ~MacroEngine(); |
| 116 | 116 | ||
| 117 | // Store the uploaded macro code to compile them when they're called. | 117 | // Store the uploaded macro code to compile them when they're called. |
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 887f40310..1f1348df3 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <unordered_map> | 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_hle.h" | 8 | #include "video_core/macro/macro_hle.h" |
| @@ -78,22 +78,22 @@ static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, | |||
| 78 | maxwell3d.CallMethodFromMME(0x8e5, 0x0); | 78 | maxwell3d.CallMethodFromMME(0x8e5, 0x0); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static const std::unordered_map<u64, HLEFunction> hle_funcs{ | 81 | static const std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{ |
| 82 | {0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, | 82 | std::make_pair<u64, HLEFunction>(0x771BB18C62444DA0, &HLE_771BB18C62444DA0), |
| 83 | {0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD}, | 83 | std::make_pair<u64, HLEFunction>(0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD), |
| 84 | {0x0217920100488FF7, &HLE_0217920100488FF7}, | 84 | std::make_pair<u64, HLEFunction>(0x0217920100488FF7, &HLE_0217920100488FF7), |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} | 87 | HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} |
| 88 | HLEMacro::~HLEMacro() = default; | 88 | HLEMacro::~HLEMacro() = default; |
| 89 | 89 | ||
| 90 | std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const { | 90 | std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const { |
| 91 | auto it = hle_funcs.find(hash); | 91 | const auto it = std::find_if(hle_funcs.begin(), hle_funcs.end(), |
| 92 | if (it != hle_funcs.end()) { | 92 | [hash](auto& pair) { return pair.first == hash; }); |
| 93 | return std::make_unique<HLEMacroImpl>(maxwell3d, it->second); | 93 | if (it == hle_funcs.end()) { |
| 94 | } else { | 94 | return std::nullopt; |
| 95 | return {}; | ||
| 96 | } | 95 | } |
| 96 | return std::make_unique<HLEMacroImpl>(maxwell3d, it->second); | ||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | HLEMacroImpl::~HLEMacroImpl() = default; | 99 | HLEMacroImpl::~HLEMacroImpl() = default; |
diff --git a/src/video_core/macro/macro_hle.h b/src/video_core/macro/macro_hle.h index de7f43dc4..7cd492a8f 100644 --- a/src/video_core/macro/macro_hle.h +++ b/src/video_core/macro/macro_hle.h | |||
| @@ -20,7 +20,7 @@ using HLEFunction = void (*)(Engines::Maxwell3D& maxwell3d, const std::vector<u3 | |||
| 20 | 20 | ||
| 21 | class HLEMacro { | 21 | class HLEMacro { |
| 22 | public: | 22 | public: |
| 23 | HLEMacro(Engines::Maxwell3D& maxwell3d); | 23 | explicit HLEMacro(Engines::Maxwell3D& maxwell3d); |
| 24 | ~HLEMacro(); | 24 | ~HLEMacro(); |
| 25 | std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const; | 25 | std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const; |
| 26 | 26 | ||