diff options
| author | 2019-12-19 01:46:20 -0300 | |
|---|---|---|
| committer | 2019-12-19 16:24:45 -0300 | |
| commit | 2a63b3bdb920a48a341f624361730f5c148fafe7 (patch) | |
| tree | 669654cbe0fea367e02d8766be79b9f6ccac666c | |
| parent | vk_shader_decompiler: Skip NDC correction when it is native (diff) | |
| download | yuzu-2a63b3bdb920a48a341f624361730f5c148fafe7.tar.gz yuzu-2a63b3bdb920a48a341f624361730f5c148fafe7.tar.xz yuzu-2a63b3bdb920a48a341f624361730f5c148fafe7.zip | |
vk_shader_decompiler: Fix full decompilation
When full decompilation was enabled, labels were not being inserted and
instructions were misused. Fix these bugs.
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 6c7f73d48..833145971 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -2594,7 +2594,7 @@ public: | |||
| 2594 | const Id target = decomp.Constant(decomp.t_uint, expr.value); | 2594 | const Id target = decomp.Constant(decomp.t_uint, expr.value); |
| 2595 | Id gpr = decomp.OpLoad(decomp.t_float, decomp.registers.at(expr.gpr)); | 2595 | Id gpr = decomp.OpLoad(decomp.t_float, decomp.registers.at(expr.gpr)); |
| 2596 | gpr = decomp.OpBitcast(decomp.t_uint, gpr); | 2596 | gpr = decomp.OpBitcast(decomp.t_uint, gpr); |
| 2597 | return decomp.OpLogicalEqual(decomp.t_uint, gpr, target); | 2597 | return decomp.OpIEqual(decomp.t_bool, gpr, target); |
| 2598 | } | 2598 | } |
| 2599 | 2599 | ||
| 2600 | Id Visit(const Expr& node) { | 2600 | Id Visit(const Expr& node) { |
| @@ -2664,11 +2664,11 @@ public: | |||
| 2664 | const Id loop_label = decomp.OpLabel(); | 2664 | const Id loop_label = decomp.OpLabel(); |
| 2665 | const Id endloop_label = decomp.OpLabel(); | 2665 | const Id endloop_label = decomp.OpLabel(); |
| 2666 | const Id loop_start_block = decomp.OpLabel(); | 2666 | const Id loop_start_block = decomp.OpLabel(); |
| 2667 | const Id loop_end_block = decomp.OpLabel(); | 2667 | const Id loop_continue_block = decomp.OpLabel(); |
| 2668 | current_loop_exit = endloop_label; | 2668 | current_loop_exit = endloop_label; |
| 2669 | decomp.OpBranch(loop_label); | 2669 | decomp.OpBranch(loop_label); |
| 2670 | decomp.AddLabel(loop_label); | 2670 | decomp.AddLabel(loop_label); |
| 2671 | decomp.OpLoopMerge(endloop_label, loop_end_block, spv::LoopControlMask::MaskNone); | 2671 | decomp.OpLoopMerge(endloop_label, loop_continue_block, spv::LoopControlMask::MaskNone); |
| 2672 | decomp.OpBranch(loop_start_block); | 2672 | decomp.OpBranch(loop_start_block); |
| 2673 | decomp.AddLabel(loop_start_block); | 2673 | decomp.AddLabel(loop_start_block); |
| 2674 | ASTNode current = ast.nodes.GetFirst(); | 2674 | ASTNode current = ast.nodes.GetFirst(); |
| @@ -2676,6 +2676,8 @@ public: | |||
| 2676 | Visit(current); | 2676 | Visit(current); |
| 2677 | current = current->GetNext(); | 2677 | current = current->GetNext(); |
| 2678 | } | 2678 | } |
| 2679 | decomp.OpBranch(loop_continue_block); | ||
| 2680 | decomp.AddLabel(loop_continue_block); | ||
| 2679 | ExprDecompiler expr_parser{decomp}; | 2681 | ExprDecompiler expr_parser{decomp}; |
| 2680 | const Id condition = expr_parser.Visit(ast.condition); | 2682 | const Id condition = expr_parser.Visit(ast.condition); |
| 2681 | decomp.OpBranchConditional(condition, loop_label, endloop_label); | 2683 | decomp.OpBranchConditional(condition, loop_label, endloop_label); |