summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-08-25 14:26:49 -0400
committerGravatar ameerj2021-08-30 11:46:25 -0400
commit907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1 (patch)
tree03d206644462b28e726a66a52ff17df41f96598b /src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
parentstructured_control_flow: Conditionally invoke demote reorder pass (diff)
downloadyuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.gz
yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.tar.xz
yuzu-907dfbea71bbfd92290d1eff1d2f0f7a33b32dc1.zip
structured_control_flow: Skip reordering nested demote branches.
Nested demote branches add complexity with combining the condition if it has not been initialized yet. Skip them for the time being.
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp')
-rw-r--r--src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp11
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:
872 std::vector<IR::Block*> demote_blocks; 872 std::vector<IR::Block*> demote_blocks;
873 std::vector<IR::U1> demote_conds; 873 std::vector<IR::U1> demote_conds;
874 u32 num_epilogues{}; 874 u32 num_epilogues{};
875 u32 branch_depth{};
875 for (const IR::AbstractSyntaxNode& node : syntax_list) { 876 for (const IR::AbstractSyntaxNode& node : syntax_list) {
877 if (node.type == Type::If) {
878 ++branch_depth;
879 }
880 if (node.type == Type::EndIf) {
881 --branch_depth;
882 }
876 if (node.type != Type::Block) { 883 if (node.type != Type::Block) {
877 continue; 884 continue;
878 } 885 }
886 if (branch_depth > 1) {
887 // Skip reordering nested demote branches.
888 continue;
889 }
879 for (const IR::Inst& inst : node.data.block->Instructions()) { 890 for (const IR::Inst& inst : node.data.block->Instructions()) {
880 const IR::Opcode op{inst.GetOpcode()}; 891 const IR::Opcode op{inst.GetOpcode()};
881 if (op == IR::Opcode::DemoteToHelperInvocation) { 892 if (op == IR::Opcode::DemoteToHelperInvocation) {