diff options
| author | 2019-09-03 22:32:42 -0400 | |
|---|---|---|
| committer | 2019-09-03 22:32:42 -0400 | |
| commit | 137d16567223cec46a7c8cf7f95792c135777a18 (patch) | |
| tree | c8e7d9038bdcfd507548a83d39cd245d86d66d49 | |
| parent | Merge pull request #2831 from FearlessTobi/port-4914 (diff) | |
| parent | maxwell_3d: Fix macro binding cursor (diff) | |
| download | yuzu-137d16567223cec46a7c8cf7f95792c135777a18.tar.gz yuzu-137d16567223cec46a7c8cf7f95792c135777a18.tar.xz yuzu-137d16567223cec46a7c8cf7f95792c135777a18.zip | |
Merge pull request #2826 from ReinUsesLisp/macro-binding
maxwell_3d: Fix macro binding cursor
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 6a5a4f5c4..f5158d219 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -249,16 +249,10 @@ void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { | |||
| 249 | executing_macro = 0; | 249 | executing_macro = 0; |
| 250 | 250 | ||
| 251 | // Lookup the macro offset | 251 | // Lookup the macro offset |
| 252 | const u32 entry{(method - MacroRegistersStart) >> 1}; | 252 | const u32 entry = ((method - MacroRegistersStart) >> 1) % macro_positions.size(); |
| 253 | const auto& search{macro_offsets.find(entry)}; | ||
| 254 | if (search == macro_offsets.end()) { | ||
| 255 | LOG_CRITICAL(HW_GPU, "macro not found for method 0x{:X}!", method); | ||
| 256 | UNREACHABLE(); | ||
| 257 | return; | ||
| 258 | } | ||
| 259 | 253 | ||
| 260 | // Execute the current macro. | 254 | // Execute the current macro. |
| 261 | macro_interpreter.Execute(search->second, std::move(parameters)); | 255 | macro_interpreter.Execute(macro_positions[entry], std::move(parameters)); |
| 262 | } | 256 | } |
| 263 | 257 | ||
| 264 | void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | 258 | void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { |
| @@ -421,7 +415,7 @@ void Maxwell3D::ProcessMacroUpload(u32 data) { | |||
| 421 | } | 415 | } |
| 422 | 416 | ||
| 423 | void Maxwell3D::ProcessMacroBind(u32 data) { | 417 | void Maxwell3D::ProcessMacroBind(u32 data) { |
| 424 | macro_offsets[regs.macros.entry] = data; | 418 | macro_positions[regs.macros.entry++] = data; |
| 425 | } | 419 | } |
| 426 | 420 | ||
| 427 | void Maxwell3D::ProcessQueryGet() { | 421 | void Maxwell3D::ProcessQueryGet() { |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 1ee982b76..0184342a0 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1270,7 +1270,7 @@ private: | |||
| 1270 | MemoryManager& memory_manager; | 1270 | MemoryManager& memory_manager; |
| 1271 | 1271 | ||
| 1272 | /// Start offsets of each macro in macro_memory | 1272 | /// Start offsets of each macro in macro_memory |
| 1273 | std::unordered_map<u32, u32> macro_offsets; | 1273 | std::array<u32, 0x80> macro_positions = {}; |
| 1274 | 1274 | ||
| 1275 | /// Memory for macro code | 1275 | /// Memory for macro code |
| 1276 | MacroMemory macro_memory; | 1276 | MacroMemory macro_memory; |