diff options
| author | 2022-11-09 17:58:10 +0100 | |
|---|---|---|
| committer | 2023-01-01 16:43:57 -0500 | |
| commit | aad0cbf024fb8077a9b375a093c60a7e2ab1db3d (patch) | |
| tree | 8c6a86c92ed8cedbafb5f34dd9f72283eaaf4342 /src/video_core/shader_environment.h | |
| parent | MacroHLE: Add Index Buffer size estimation. (diff) | |
| download | yuzu-aad0cbf024fb8077a9b375a093c60a7e2ab1db3d.tar.gz yuzu-aad0cbf024fb8077a9b375a093c60a7e2ab1db3d.tar.xz yuzu-aad0cbf024fb8077a9b375a093c60a7e2ab1db3d.zip | |
MacroHLE: Add HLE replacement for base vertex and base instance.
Diffstat (limited to 'src/video_core/shader_environment.h')
| -rw-r--r-- | src/video_core/shader_environment.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/video_core/shader_environment.h b/src/video_core/shader_environment.h index 1342fab1e..d75987a52 100644 --- a/src/video_core/shader_environment.h +++ b/src/video_core/shader_environment.h | |||
| @@ -60,6 +60,10 @@ public: | |||
| 60 | 60 | ||
| 61 | void Serialize(std::ofstream& file) const; | 61 | void Serialize(std::ofstream& file) const; |
| 62 | 62 | ||
| 63 | bool HasHLEMacroState() const override { | ||
| 64 | return has_hle_engine_state; | ||
| 65 | } | ||
| 66 | |||
| 63 | protected: | 67 | protected: |
| 64 | std::optional<u64> TryFindSize(); | 68 | std::optional<u64> TryFindSize(); |
| 65 | 69 | ||
| @@ -73,6 +77,7 @@ protected: | |||
| 73 | std::unordered_map<u32, Shader::TextureType> texture_types; | 77 | std::unordered_map<u32, Shader::TextureType> texture_types; |
| 74 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; | 78 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; |
| 75 | std::unordered_map<u64, u32> cbuf_values; | 79 | std::unordered_map<u64, u32> cbuf_values; |
| 80 | std::unordered_map<u64, Shader::ReplaceConstant> cbuf_replacements; | ||
| 76 | 81 | ||
| 77 | u32 local_memory_size{}; | 82 | u32 local_memory_size{}; |
| 78 | u32 texture_bound{}; | 83 | u32 texture_bound{}; |
| @@ -89,6 +94,7 @@ protected: | |||
| 89 | u32 viewport_transform_state = 1; | 94 | u32 viewport_transform_state = 1; |
| 90 | 95 | ||
| 91 | bool has_unbound_instructions = false; | 96 | bool has_unbound_instructions = false; |
| 97 | bool has_hle_engine_state = false; | ||
| 92 | }; | 98 | }; |
| 93 | 99 | ||
| 94 | class GraphicsEnvironment final : public GenericEnvironment { | 100 | class GraphicsEnvironment final : public GenericEnvironment { |
| @@ -109,6 +115,8 @@ public: | |||
| 109 | 115 | ||
| 110 | u32 ReadViewportTransformState() override; | 116 | u32 ReadViewportTransformState() override; |
| 111 | 117 | ||
| 118 | std::optional<Shader::ReplaceConstant> GetReplaceConstBuffer(u32 bank, u32 offset) override; | ||
| 119 | |||
| 112 | private: | 120 | private: |
| 113 | Tegra::Engines::Maxwell3D* maxwell3d{}; | 121 | Tegra::Engines::Maxwell3D* maxwell3d{}; |
| 114 | size_t stage_index{}; | 122 | size_t stage_index{}; |
| @@ -131,6 +139,11 @@ public: | |||
| 131 | 139 | ||
| 132 | u32 ReadViewportTransformState() override; | 140 | u32 ReadViewportTransformState() override; |
| 133 | 141 | ||
| 142 | std::optional<Shader::ReplaceConstant> GetReplaceConstBuffer( | ||
| 143 | [[maybe_unused]] u32 bank, [[maybe_unused]] u32 offset) override { | ||
| 144 | return std::nullopt; | ||
| 145 | } | ||
| 146 | |||
| 134 | private: | 147 | private: |
| 135 | Tegra::Engines::KeplerCompute* kepler_compute{}; | 148 | Tegra::Engines::KeplerCompute* kepler_compute{}; |
| 136 | }; | 149 | }; |
| @@ -166,6 +179,13 @@ public: | |||
| 166 | 179 | ||
| 167 | [[nodiscard]] std::array<u32, 3> WorkgroupSize() const override; | 180 | [[nodiscard]] std::array<u32, 3> WorkgroupSize() const override; |
| 168 | 181 | ||
| 182 | [[nodiscard]] std::optional<Shader::ReplaceConstant> GetReplaceConstBuffer(u32 bank, | ||
| 183 | u32 offset) override; | ||
| 184 | |||
| 185 | [[nodiscard]] bool HasHLEMacroState() const override { | ||
| 186 | return cbuf_replacements.size() != 0; | ||
| 187 | } | ||
| 188 | |||
| 169 | void Dump(u64 hash) override; | 189 | void Dump(u64 hash) override; |
| 170 | 190 | ||
| 171 | private: | 191 | private: |
| @@ -173,6 +193,7 @@ private: | |||
| 173 | std::unordered_map<u32, Shader::TextureType> texture_types; | 193 | std::unordered_map<u32, Shader::TextureType> texture_types; |
| 174 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; | 194 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; |
| 175 | std::unordered_map<u64, u32> cbuf_values; | 195 | std::unordered_map<u64, u32> cbuf_values; |
| 196 | std::unordered_map<u64, Shader::ReplaceConstant> cbuf_replacements; | ||
| 176 | std::array<u32, 3> workgroup_size{}; | 197 | std::array<u32, 3> workgroup_size{}; |
| 177 | u32 local_memory_size{}; | 198 | u32 local_memory_size{}; |
| 178 | u32 shared_memory_size{}; | 199 | u32 shared_memory_size{}; |