diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-03-14 06:30:19 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-04-10 19:20:25 +0200 |
commit | fec4eb9776bc063d109e5fd5f23906df45e715a1 (patch) | |
tree | c7c9fc272073deb1ad23fd737b698a578f2ea1b9 /src/video_core/renderer_vulkan | |
parent | vk_shader_decompiler: Implement labels tree and flow (diff) | |
download | yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.gz yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.bz2 yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.lz yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.xz yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.tar.zst yuzu-fec4eb9776bc063d109e5fd5f23906df45e715a1.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan')
-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: Emit(default_branch); Emit(OpReturn()); - UNIMPLEMENTED(); + for (const auto& pair : ir.GetBasicBlocks()) { + const auto& [address, bb] = pair; + Emit(labels.at(address)); + + VisitBasicBlock(bb); + + const auto next_it = labels.lower_bound(address + 1); + const Id next_label = next_it != labels.end() ? next_it->second : default_branch; + Emit(OpBranch(next_label)); + } Emit(jump_label); Emit(OpBranch(continue_label)); @@ -451,6 +460,46 @@ private: interfaces.push_back(per_vertex); } + void VisitBasicBlock(const NodeBlock& bb) { + for (const Node node : bb) { + static_cast<void>(Visit(node)); + } + } + + Id Visit(Node node) { + if (const auto operation = std::get_if<OperationNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto gpr = std::get_if<GprNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto immediate = std::get_if<ImmediateNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto predicate = std::get_if<PredicateNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto abuf = std::get_if<AbufNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto cbuf = std::get_if<CbufNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto gmem = std::get_if<GmemNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto conditional = std::get_if<ConditionalNode>(node)) { + UNIMPLEMENTED(); + + } else if (const auto comment = std::get_if<CommentNode>(node)) { + Name(Emit(OpUndef(t_void)), comment->GetText()); + return {}; + } + + UNREACHABLE(); + return {}; + } + Id DeclareBuiltIn(spv::BuiltIn builtin, spv::StorageClass storage, Id type, const std::string& name) { const Id id = OpVariable(type, storage); |