diff options
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp')
| -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: | |||
| 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) { |