summaryrefslogtreecommitdiffstats
path: root/src/video_core/macro/macro_hle.cpp
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2020-06-05 05:09:52 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2020-06-24 04:09:03 +0200
commitfabdf5d3850c078d173653f259845c26a2ce6e7d (patch)
tree151a9eeefd518722f45cbe6446f1928ebf26bddb /src/video_core/macro/macro_hle.cpp
parentFix constbuffer for 0217920100488FF7 (diff)
downloadyuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.tar
yuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.tar.gz
yuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.tar.bz2
yuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.tar.lz
yuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.tar.xz
yuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.tar.zst
yuzu-fabdf5d3850c078d173653f259845c26a2ce6e7d.zip
Diffstat (limited to 'src/video_core/macro/macro_hle.cpp')
-rw-r--r--src/video_core/macro/macro_hle.cpp20
1 files changed, 10 insertions, 10 deletions
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <unordered_map>
+#include <array>
#include <vector>
#include "video_core/engines/maxwell_3d.h"
#include "video_core/macro/macro_hle.h"
@@ -78,22 +78,22 @@ static void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d,
maxwell3d.CallMethodFromMME(0x8e5, 0x0);
}
-static const std::unordered_map<u64, HLEFunction> hle_funcs{
- {0x771BB18C62444DA0, &HLE_771BB18C62444DA0},
- {0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD},
- {0x0217920100488FF7, &HLE_0217920100488FF7},
+static const std::array<std::pair<u64, HLEFunction>, 3> hle_funcs{
+ std::make_pair<u64, HLEFunction>(0x771BB18C62444DA0, &HLE_771BB18C62444DA0),
+ std::make_pair<u64, HLEFunction>(0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD),
+ std::make_pair<u64, HLEFunction>(0x0217920100488FF7, &HLE_0217920100488FF7),
};
HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {}
HLEMacro::~HLEMacro() = default;
std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const {
- auto it = hle_funcs.find(hash);
- if (it != hle_funcs.end()) {
- return std::make_unique<HLEMacroImpl>(maxwell3d, it->second);
- } else {
- return {};
+ const auto it = std::find_if(hle_funcs.begin(), hle_funcs.end(),
+ [hash](auto& pair) { return pair.first == hash; });
+ if (it == hle_funcs.end()) {
+ return std::nullopt;
}
+ return std::make_unique<HLEMacroImpl>(maxwell3d, it->second);
}
HLEMacroImpl::~HLEMacroImpl() = default;