diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2020-06-04 17:42:19 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2020-06-24 04:09:01 +0200 |
commit | 6ce5f3120be6a65a798d3abc6fda0fe6171d0296 (patch) | |
tree | c63966fe5761248a4f48f4ccb4567b6213773fa4 /src/video_core/macro/macro.h | |
parent | Merge pull request #4138 from Morph1984/GyroscopeZeroDriftMode (diff) | |
download | yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.gz yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.bz2 yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.lz yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.xz yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.zst yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.zip |
Diffstat (limited to 'src/video_core/macro/macro.h')
-rw-r--r-- | src/video_core/macro/macro.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/video_core/macro/macro.h b/src/video_core/macro/macro.h index b76ed891f..5fa8023af 100644 --- a/src/video_core/macro/macro.h +++ b/src/video_core/macro/macro.h @@ -11,9 +11,11 @@ #include "common/common_types.h" namespace Tegra { + namespace Engines { class Maxwell3D; } + namespace Macro { constexpr std::size_t NUM_MACRO_REGISTERS = 8; enum class Operation : u32 { @@ -94,6 +96,8 @@ union MethodAddress { } // namespace Macro +class HLEMacro; + class CachedMacro { public: virtual ~CachedMacro() = default; @@ -107,20 +111,29 @@ public: class MacroEngine { public: - virtual ~MacroEngine() = default; + MacroEngine(Engines::Maxwell3D& maxwell3d); + virtual ~MacroEngine(); // Store the uploaded macro code to compile them when they're called. void AddCode(u32 method, u32 data); // Compiles the macro if its not in the cache, and executes the compiled macro - void Execute(u32 method, const std::vector<u32>& parameters); + void Execute(Engines::Maxwell3D& maxwell3d, u32 method, const std::vector<u32>& parameters); protected: virtual std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) = 0; private: - std::unordered_map<u32, std::unique_ptr<CachedMacro>> macro_cache; + struct CacheInfo { + std::unique_ptr<CachedMacro> lle_program{}; + std::unique_ptr<CachedMacro> hle_program{}; + u64 hash{}; + bool has_hle_program{}; + }; + + std::unordered_map<u32, CacheInfo> macro_cache; std::unordered_map<u32, std::vector<u32>> uploaded_macro_code; + std::unique_ptr<HLEMacro> hle_macros; }; std::unique_ptr<MacroEngine> GetMacroEngine(Engines::Maxwell3D& maxwell3d); |