diff options
| author | 2019-03-14 02:30:19 -0300 | |
|---|---|---|
| committer | 2019-04-10 14:20:25 -0300 | |
| commit | fec4eb9776bc063d109e5fd5f23906df45e715a1 (patch) | |
| tree | c7c9fc272073deb1ad23fd737b698a578f2ea1b9 /src | |
| parent | vk_shader_decompiler: Implement labels tree and flow (diff) | |
| download | yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.gz yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.xz yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.zip | |
vk_shader_decompiler: Implement Visit
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 7af8e79df..5f174bb7f 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -149,7 +149,16 @@ public: | |||
| 149 | Emit(default_branch); | 149 | Emit(default_branch); |
| 150 | Emit(OpReturn()); | 150 | Emit(OpReturn()); |
| 151 | 151 | ||
| 152 | UNIMPLEMENTED(); | 152 | for (const auto& pair : ir.GetBasicBlocks()) { |
| 153 | const auto& [address, bb] = pair; | ||
| 154 | Emit(labels.at(address)); | ||
| 155 | |||
| 156 | VisitBasicBlock(bb); | ||
| 157 | |||
| 158 | const auto next_it = labels.lower_bound(address + 1); | ||
| 159 | const Id next_label = next_it != labels.end() ? next_it->second : default_branch; | ||
| 160 | Emit(OpBranch(next_label)); | ||
| 161 | } | ||
| 153 | 162 | ||
| 154 | Emit(jump_label); | 163 | Emit(jump_label); |
| 155 | Emit(OpBranch(continue_label)); | 164 | Emit(OpBranch(continue_label)); |
| @@ -451,6 +460,46 @@ private: | |||
| 451 | interfaces.push_back(per_vertex); | 460 | interfaces.push_back(per_vertex); |
| 452 | } | 461 | } |
| 453 | 462 | ||
| 463 | void VisitBasicBlock(const NodeBlock& bb) { | ||
| 464 | for (const Node node : bb) { | ||
| 465 | static_cast<void>(Visit(node)); | ||
| 466 | } | ||
| 467 | } | ||
| 468 | |||
| 469 | Id Visit(Node node) { | ||
| 470 | if (const auto operation = std::get_if<OperationNode>(node)) { | ||
| 471 | UNIMPLEMENTED(); | ||
| 472 | |||
| 473 | } else if (const auto gpr = std::get_if<GprNode>(node)) { | ||
| 474 | UNIMPLEMENTED(); | ||
| 475 | |||
| 476 | } else if (const auto immediate = std::get_if<ImmediateNode>(node)) { | ||
| 477 | UNIMPLEMENTED(); | ||
| 478 | |||
| 479 | } else if (const auto predicate = std::get_if<PredicateNode>(node)) { | ||
| 480 | UNIMPLEMENTED(); | ||
| 481 | |||
| 482 | } else if (const auto abuf = std::get_if<AbufNode>(node)) { | ||
| 483 | UNIMPLEMENTED(); | ||
| 484 | |||
| 485 | } else if (const auto cbuf = std::get_if<CbufNode>(node)) { | ||
| 486 | UNIMPLEMENTED(); | ||
| 487 | |||
| 488 | } else if (const auto gmem = std::get_if<GmemNode>(node)) { | ||
| 489 | UNIMPLEMENTED(); | ||
| 490 | |||
| 491 | } else if (const auto conditional = std::get_if<ConditionalNode>(node)) { | ||
| 492 | UNIMPLEMENTED(); | ||
| 493 | |||
| 494 | } else if (const auto comment = std::get_if<CommentNode>(node)) { | ||
| 495 | Name(Emit(OpUndef(t_void)), comment->GetText()); | ||
| 496 | return {}; | ||
| 497 | } | ||
| 498 | |||
| 499 | UNREACHABLE(); | ||
| 500 | return {}; | ||
| 501 | } | ||
| 502 | |||
| 454 | Id DeclareBuiltIn(spv::BuiltIn builtin, spv::StorageClass storage, Id type, | 503 | Id DeclareBuiltIn(spv::BuiltIn builtin, spv::StorageClass storage, Id type, |
| 455 | const std::string& name) { | 504 | const std::string& name) { |
| 456 | const Id id = OpVariable(type, storage); | 505 | const Id id = OpVariable(type, storage); |