diff options
| author | 2020-06-05 01:42:19 +1000 | |
|---|---|---|
| committer | 2020-06-24 12:09:01 +1000 | |
| commit | 6ce5f3120be6a65a798d3abc6fda0fe6171d0296 (patch) | |
| tree | c63966fe5761248a4f48f4ccb4567b6213773fa4 /src/video_core/macro/macro.h | |
| parent | Merge pull request #4138 from Morph1984/GyroscopeZeroDriftMode (diff) | |
| download | yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.gz yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.tar.xz yuzu-6ce5f3120be6a65a798d3abc6fda0fe6171d0296.zip | |
Macro HLE support
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 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace Tegra { | 13 | namespace Tegra { |
| 14 | |||
| 14 | namespace Engines { | 15 | namespace Engines { |
| 15 | class Maxwell3D; | 16 | class Maxwell3D; |
| 16 | } | 17 | } |
| 18 | |||
| 17 | namespace Macro { | 19 | namespace Macro { |
| 18 | constexpr std::size_t NUM_MACRO_REGISTERS = 8; | 20 | constexpr std::size_t NUM_MACRO_REGISTERS = 8; |
| 19 | enum class Operation : u32 { | 21 | enum class Operation : u32 { |
| @@ -94,6 +96,8 @@ union MethodAddress { | |||
| 94 | 96 | ||
| 95 | } // namespace Macro | 97 | } // namespace Macro |
| 96 | 98 | ||
| 99 | class HLEMacro; | ||
| 100 | |||
| 97 | class CachedMacro { | 101 | class CachedMacro { |
| 98 | public: | 102 | public: |
| 99 | virtual ~CachedMacro() = default; | 103 | virtual ~CachedMacro() = default; |
| @@ -107,20 +111,29 @@ public: | |||
| 107 | 111 | ||
| 108 | class MacroEngine { | 112 | class MacroEngine { |
| 109 | public: | 113 | public: |
| 110 | virtual ~MacroEngine() = default; | 114 | MacroEngine(Engines::Maxwell3D& maxwell3d); |
| 115 | virtual ~MacroEngine(); | ||
| 111 | 116 | ||
| 112 | // 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. |
| 113 | void AddCode(u32 method, u32 data); | 118 | void AddCode(u32 method, u32 data); |
| 114 | 119 | ||
| 115 | // Compiles the macro if its not in the cache, and executes the compiled macro | 120 | // Compiles the macro if its not in the cache, and executes the compiled macro |
| 116 | void Execute(u32 method, const std::vector<u32>& parameters); | 121 | void Execute(Engines::Maxwell3D& maxwell3d, u32 method, const std::vector<u32>& parameters); |
| 117 | 122 | ||
| 118 | protected: | 123 | protected: |
| 119 | virtual std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) = 0; | 124 | virtual std::unique_ptr<CachedMacro> Compile(const std::vector<u32>& code) = 0; |
| 120 | 125 | ||
| 121 | private: | 126 | private: |
| 122 | std::unordered_map<u32, std::unique_ptr<CachedMacro>> macro_cache; | 127 | struct CacheInfo { |
| 128 | std::unique_ptr<CachedMacro> lle_program{}; | ||
| 129 | std::unique_ptr<CachedMacro> hle_program{}; | ||
| 130 | u64 hash{}; | ||
| 131 | bool has_hle_program{}; | ||
| 132 | }; | ||
| 133 | |||
| 134 | std::unordered_map<u32, CacheInfo> macro_cache; | ||
| 123 | std::unordered_map<u32, std::vector<u32>> uploaded_macro_code; | 135 | std::unordered_map<u32, std::vector<u32>> uploaded_macro_code; |
| 136 | std::unique_ptr<HLEMacro> hle_macros; | ||
| 124 | }; | 137 | }; |
| 125 | 138 | ||
| 126 | std::unique_ptr<MacroEngine> GetMacroEngine(Engines::Maxwell3D& maxwell3d); | 139 | std::unique_ptr<MacroEngine> GetMacroEngine(Engines::Maxwell3D& maxwell3d); |