diff options
author | Lioncash <mathew1800@gmail.com> | 2022-01-25 19:50:10 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2022-01-25 19:50:14 +0100 |
commit | cfd9f7d25b4c1aea49b4dc017990f12142b8302b (patch) | |
tree | 7ab83e57f2340b5447738cdc195489312e530a54 /src | |
parent | video_core/macro: Remove unused parameter from Execute() (diff) | |
download | yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.tar yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.tar.gz yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.tar.bz2 yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.tar.lz yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.tar.xz yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.tar.zst yuzu-cfd9f7d25b4c1aea49b4dc017990f12142b8302b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/macro/macro.cpp | 5 | ||||
-rw-r--r-- | src/video_core/macro/macro_hle.cpp | 4 | ||||
-rw-r--r-- | src/video_core/macro/macro_hle.h | 5 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp index 0870a7687..0ae78a9e5 100644 --- a/src/video_core/macro/macro.cpp +++ b/src/video_core/macro/macro.cpp @@ -65,10 +65,9 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) { cache_info.lle_program = Compile(code); } - auto hle_program = hle_macros->GetHLEProgram(cache_info.hash); - if (hle_program.has_value()) { + if (auto hle_program = hle_macros->GetHLEProgram(cache_info.hash)) { cache_info.has_hle_program = true; - cache_info.hle_program = std::move(hle_program.value()); + cache_info.hle_program = std::move(hle_program); cache_info.hle_program->Execute(parameters, method); } else { cache_info.lle_program->Execute(parameters, method); diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 3f743ce55..900ad23c9 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -105,11 +105,11 @@ private: HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} HLEMacro::~HLEMacro() = default; -std::optional<std::unique_ptr<CachedMacro>> HLEMacro::GetHLEProgram(u64 hash) const { +std::unique_ptr<CachedMacro> HLEMacro::GetHLEProgram(u64 hash) const { const auto it = std::find_if(hle_funcs.cbegin(), hle_funcs.cend(), [hash](const auto& pair) { return pair.first == hash; }); if (it == hle_funcs.end()) { - return std::nullopt; + return nullptr; } return std::make_unique<HLEMacroImpl>(maxwell3d, it->second); } diff --git a/src/video_core/macro/macro_hle.h b/src/video_core/macro/macro_hle.h index c0a12e793..b86ba84a1 100644 --- a/src/video_core/macro/macro_hle.h +++ b/src/video_core/macro/macro_hle.h @@ -5,7 +5,6 @@ #pragma once #include <memory> -#include <optional> #include "common/common_types.h" namespace Tegra { @@ -19,7 +18,9 @@ public: explicit HLEMacro(Engines::Maxwell3D& maxwell3d_); ~HLEMacro(); - std::optional<std::unique_ptr<CachedMacro>> GetHLEProgram(u64 hash) const; + // Allocates and returns a cached macro if the hash matches a known function. + // Returns nullptr otherwise. + [[nodiscard]] std::unique_ptr<CachedMacro> GetHLEProgram(u64 hash) const; private: Engines::Maxwell3D& maxwell3d; |