diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-08-25 20:26:49 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-08-30 17:46:25 +0200 |
commit | 907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1 (patch) | |
tree | 03d206644462b28e726a66a52ff17df41f96598b | |
parent | structured_control_flow: Conditionally invoke demote reorder pass (diff) | |
download | yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.gz yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.bz2 yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.lz yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.xz yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.zst yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.zip |
-rw-r--r-- | src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp index 77d1cd0fc..69eeaa3e6 100644 --- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp @@ -872,10 +872,21 @@ private: std::vector<IR::Block*> demote_blocks; std::vector<IR::U1> demote_conds; u32 num_epilogues{}; + u32 branch_depth{}; for (const IR::AbstractSyntaxNode& node : syntax_list) { + if (node.type == Type::If) { + ++branch_depth; + } + if (node.type == Type::EndIf) { + --branch_depth; + } if (node.type != Type::Block) { continue; } + if (branch_depth > 1) { + // Skip reordering nested demote branches. + continue; + } for (const IR::Inst& inst : node.data.block->Instructions()) { const IR::Opcode op{inst.GetOpcode()}; if (op == IR::Opcode::DemoteToHelperInvocation) { |