diff options
Diffstat (limited to 'src/shader_recompiler/ir_opt')
| -rw-r--r-- | src/shader_recompiler/ir_opt/dual_vertex_pass.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp b/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp index f35c6478a..f2d7db0e6 100644 --- a/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp +++ b/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <ranges> | 6 | #include <ranges> |
| 7 | #include <tuple> | ||
| 8 | #include <type_traits> | ||
| 9 | 7 | ||
| 10 | #include "common/bit_cast.h" | 8 | #include "common/bit_cast.h" |
| 11 | #include "common/bit_util.h" | 9 | #include "common/bit_util.h" |
| @@ -40,7 +38,7 @@ void VertexATransformPass(IR::Program& program) { | |||
| 40 | } | 38 | } |
| 41 | 39 | ||
| 42 | void VertexBTransformPass(IR::Program& program) { | 40 | void VertexBTransformPass(IR::Program& program) { |
| 43 | for (IR::Block* const block : program.post_order_blocks | std::views::reverse) { | 41 | for (IR::Block* const block : program.blocks) { |
| 44 | for (IR::Inst& inst : block->Instructions()) { | 42 | for (IR::Inst& inst : block->Instructions()) { |
| 45 | if (inst.GetOpcode() == IR::Opcode::Prologue) { | 43 | if (inst.GetOpcode() == IR::Opcode::Prologue) { |
| 46 | return inst.Invalidate(); | 44 | return inst.Invalidate(); |
| @@ -51,24 +49,24 @@ void VertexBTransformPass(IR::Program& program) { | |||
| 51 | 49 | ||
| 52 | void DualVertexJoinPass(IR::Program& program) { | 50 | void DualVertexJoinPass(IR::Program& program) { |
| 53 | const auto& blocks = program.blocks; | 51 | const auto& blocks = program.blocks; |
| 54 | s64 s = static_cast<s64>(blocks.size()) - 1; | 52 | const s64 sub_size = static_cast<s64>(blocks.size()) - 1; |
| 55 | if (s < 1) { | 53 | if (sub_size < 1) { |
| 56 | throw NotImplementedException("Dual Vertex Join pass failed, expected atleast 2 blocks!"); | 54 | throw LogicError("Dual Vertex Join pass failed, expected atleast 2 blocks"); |
| 57 | } | 55 | } |
| 58 | for (s64 index = 0; index < s; index++) { | 56 | for (s64 index = 0; index < sub_size; ++index) { |
| 59 | IR::Block* const current_block = blocks[index]; | 57 | IR::Block* const current_block{blocks[index]}; |
| 60 | IR::Block* const next_block = blocks[index + 1]; | 58 | IR::Block* const next_block{blocks[index + 1]}; |
| 61 | for (IR::Inst& inst : current_block->Instructions()) { | 59 | for (IR::Inst& inst : current_block->Instructions()) { |
| 62 | if (inst.GetOpcode() == IR::Opcode::Join) { | 60 | if (inst.GetOpcode() == IR::Opcode::Join) { |
| 63 | IR::IREmitter ir{*current_block, IR::Block::InstructionList::s_iterator_to(inst)}; | 61 | IR::IREmitter ir{*current_block, IR::Block::InstructionList::s_iterator_to(inst)}; |
| 64 | ir.Branch(next_block); | 62 | ir.Branch(next_block); |
| 65 | inst.Invalidate(); | 63 | inst.Invalidate(); |
| 66 | // only 1 join should exist | 64 | // Only 1 join should exist |
| 67 | return; | 65 | return; |
| 68 | } | 66 | } |
| 69 | } | 67 | } |
| 70 | } | 68 | } |
| 71 | throw NotImplementedException("Dual Vertex Join pass failed, no join present!"); | 69 | throw LogicError("Dual Vertex Join pass failed, no join present"); |
| 72 | } | 70 | } |
| 73 | 71 | ||
| 74 | } // namespace Shader::Optimization | 72 | } // namespace Shader::Optimization |