summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/ir_opt/dual_vertex_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/dual_vertex_pass.cpp56
1 files changed, 6 insertions, 50 deletions
diff --git a/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp b/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp
index f2d7db0e6..b0a9f5258 100644
--- a/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp
+++ b/src/shader_recompiler/ir_opt/dual_vertex_pass.cpp
@@ -13,60 +13,16 @@
13 13
14namespace Shader::Optimization { 14namespace Shader::Optimization {
15 15
16void VertexATransformPass(IR::Program& program) { 16void VertexATransformPass(IR::Program&) {
17 bool replaced_join{}; 17 throw NotImplementedException("VertexA pass");
18 bool eliminated_epilogue{};
19 for (IR::Block* const block : program.post_order_blocks) {
20 for (IR::Inst& inst : block->Instructions()) {
21 switch (inst.GetOpcode()) {
22 case IR::Opcode::Return:
23 inst.ReplaceOpcode(IR::Opcode::Join);
24 replaced_join = true;
25 break;
26 case IR::Opcode::Epilogue:
27 inst.Invalidate();
28 eliminated_epilogue = true;
29 break;
30 default:
31 break;
32 }
33 if (replaced_join && eliminated_epilogue) {
34 return;
35 }
36 }
37 }
38} 18}
39 19
40void VertexBTransformPass(IR::Program& program) { 20void VertexBTransformPass(IR::Program&) {
41 for (IR::Block* const block : program.blocks) { 21 throw NotImplementedException("VertexA pass");
42 for (IR::Inst& inst : block->Instructions()) {
43 if (inst.GetOpcode() == IR::Opcode::Prologue) {
44 return inst.Invalidate();
45 }
46 }
47 }
48} 22}
49 23
50void DualVertexJoinPass(IR::Program& program) { 24void DualVertexJoinPass(IR::Program&) {
51 const auto& blocks = program.blocks; 25 throw NotImplementedException("VertexA pass");
52 const s64 sub_size = static_cast<s64>(blocks.size()) - 1;
53 if (sub_size < 1) {
54 throw LogicError("Dual Vertex Join pass failed, expected atleast 2 blocks");
55 }
56 for (s64 index = 0; index < sub_size; ++index) {
57 IR::Block* const current_block{blocks[index]};
58 IR::Block* const next_block{blocks[index + 1]};
59 for (IR::Inst& inst : current_block->Instructions()) {
60 if (inst.GetOpcode() == IR::Opcode::Join) {
61 IR::IREmitter ir{*current_block, IR::Block::InstructionList::s_iterator_to(inst)};
62 ir.Branch(next_block);
63 inst.Invalidate();
64 // Only 1 join should exist
65 return;
66 }
67 }
68 }
69 throw LogicError("Dual Vertex Join pass failed, no join present");
70} 26}
71 27
72} // namespace Shader::Optimization 28} // namespace Shader::Optimization