summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-25 20:34:08 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-05 00:52:56 +0200
commit507a9c6a402d6ee277e0a8f0cda57d04526c05dd (patch)
tree903a4b0e4528d3cccb848b5fa4adf97c7cf61d9b /src
parentvk_shader_decompiler: Clean code and be const correct. (diff)
downloadyuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.tar
yuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.tar.gz
yuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.tar.bz2
yuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.tar.lz
yuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.tar.xz
yuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.tar.zst
yuzu-507a9c6a402d6ee277e0a8f0cda57d04526c05dd.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp12
1 files changed, 11 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 4bc7da198..2b55a3727 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -650,7 +650,11 @@ private:
VisitBasicBlock(conditional->GetCode());
--conditional_nest_count;
- Emit(OpBranch(skip_label));
+ if (inside_branch == 0) {
+ Emit(OpBranch(skip_label));
+ } else {
+ inside_branch--;
+ }
Emit(skip_label);
return {};
@@ -1014,6 +1018,7 @@ private:
Emit(OpStore(jmp_to, Constant(t_uint, target->GetValue())));
Emit(OpBranch(continue_label));
+ inside_branch = conditional_nest_count;
if (conditional_nest_count == 0) {
Emit(OpLabel());
}
@@ -1025,6 +1030,7 @@ private:
Emit(OpStore(jmp_to, op_a));
Emit(OpBranch(continue_label));
+ inside_branch = conditional_nest_count;
if (conditional_nest_count == 0) {
Emit(OpLabel());
}
@@ -1055,6 +1061,7 @@ private:
Emit(OpStore(flow_stack_top, previous));
Emit(OpStore(jmp_to, target));
Emit(OpBranch(continue_label));
+ inside_branch = conditional_nest_count;
if (conditional_nest_count == 0) {
Emit(OpLabel());
}
@@ -1114,6 +1121,7 @@ private:
Id Exit(Operation operation) {
PreExit();
+ inside_branch = conditional_nest_count;
if (conditional_nest_count > 0) {
Emit(OpReturn());
} else {
@@ -1127,6 +1135,7 @@ private:
}
Id Discard(Operation operation) {
+ inside_branch = conditional_nest_count;
if (conditional_nest_count > 0) {
Emit(OpKill());
} else {
@@ -1536,6 +1545,7 @@ private:
const ShaderStage stage;
const Tegra::Shader::Header header;
u64 conditional_nest_count{};
+ u64 inside_branch{};
const Id t_void = Name(TypeVoid(), "void");