summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-21 06:45:13 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-05 00:52:52 +0200
commit466cd52ad47b125182baf1544c44e52a741fa58f (patch)
tree6f156ad3e81116d926894320dc6fe7a1d5bc7527 /src
parentShader_IR: allow else derivation to be optional. (diff)
downloadyuzu-466cd52ad47b125182baf1544c44e52a741fa58f.tar
yuzu-466cd52ad47b125182baf1544c44e52a741fa58f.tar.gz
yuzu-466cd52ad47b125182baf1544c44e52a741fa58f.tar.bz2
yuzu-466cd52ad47b125182baf1544c44e52a741fa58f.tar.lz
yuzu-466cd52ad47b125182baf1544c44e52a741fa58f.tar.xz
yuzu-466cd52ad47b125182baf1544c44e52a741fa58f.tar.zst
yuzu-466cd52ad47b125182baf1544c44e52a741fa58f.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 72fbc69c4..4527e9261 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -1714,6 +1714,7 @@ public:
Visit(current);
current = current->GetNext();
}
+ decomp.Emit(decomp.OpBranch(endif_label));
decomp.Emit(endif_label);
}
@@ -1749,6 +1750,7 @@ public:
const Id loop_start_block = decomp.OpLabel();
const Id loop_end_block = decomp.OpLabel();
current_loop_exit = endloop_label;
+ decomp.Emit(decomp.OpBranch(loop_label));
decomp.Emit(loop_label);
decomp.Emit(
decomp.OpLoopMerge(endloop_label, loop_end_block, spv::LoopControlMask::MaskNone));
@@ -1759,8 +1761,6 @@ public:
Visit(current);
current = current->GetNext();
}
- decomp.Emit(decomp.OpBranch(loop_end_block));
- decomp.Emit(loop_end_block);
ExprDecompiler expr_parser{decomp};
const Id condition = expr_parser.Visit(ast.condition);
decomp.Emit(decomp.OpBranchConditional(condition, loop_label, endloop_label));
@@ -1785,7 +1785,9 @@ public:
}
decomp.Emit(endif_label);
} else {
- decomp.Emit(decomp.OpLabel());
+ const Id next_block = decomp.OpLabel();
+ decomp.Emit(decomp.OpBranch(next_block));
+ decomp.Emit(next_block);
if (ast.kills) {
decomp.Emit(decomp.OpKill());
} else {
@@ -1809,7 +1811,9 @@ public:
decomp.Emit(decomp.OpBranch(current_loop_exit));
decomp.Emit(endif_label);
} else {
- decomp.Emit(decomp.OpLabel());
+ const Id next_block = decomp.OpLabel();
+ decomp.Emit(decomp.OpBranch(next_block));
+ decomp.Emit(next_block);
decomp.Emit(decomp.OpBranch(current_loop_exit));
decomp.Emit(decomp.OpLabel());
}
@@ -1834,6 +1838,9 @@ void SPIRVDecompiler::DecompileAST() {
ASTDecompiler decompiler{*this};
VideoCommon::Shader::ASTNode program = ir.GetASTProgram();
decompiler.Visit(program);
+ const Id next_block = OpLabel();
+ Emit(OpBranch(next_block));
+ Emit(next_block);
}
DecompilerResult Decompile(const VKDevice& device, const VideoCommon::Shader::ShaderIR& ir,