diff options
Diffstat (limited to 'src/shader_recompiler/frontend')
4 files changed, 32 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index 5c1b02d53..dba902186 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp | |||
| @@ -61,6 +61,7 @@ bool Inst::MayHaveSideEffects() const noexcept { | |||
| 61 | case Opcode::LoopMerge: | 61 | case Opcode::LoopMerge: |
| 62 | case Opcode::SelectionMerge: | 62 | case Opcode::SelectionMerge: |
| 63 | case Opcode::Return: | 63 | case Opcode::Return: |
| 64 | case Opcode::Join: | ||
| 64 | case Opcode::Unreachable: | 65 | case Opcode::Unreachable: |
| 65 | case Opcode::DemoteToHelperInvocation: | 66 | case Opcode::DemoteToHelperInvocation: |
| 66 | case Opcode::Barrier: | 67 | case Opcode::Barrier: |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 8f32c9e74..b14719c51 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -13,6 +13,7 @@ OPCODE(BranchConditional, Void, U1, | |||
| 13 | OPCODE(LoopMerge, Void, Label, Label, ) | 13 | OPCODE(LoopMerge, Void, Label, Label, ) |
| 14 | OPCODE(SelectionMerge, Void, Label, ) | 14 | OPCODE(SelectionMerge, Void, Label, ) |
| 15 | OPCODE(Return, Void, ) | 15 | OPCODE(Return, Void, ) |
| 16 | OPCODE(Join, Void, ) | ||
| 16 | OPCODE(Unreachable, Void, ) | 17 | OPCODE(Unreachable, Void, ) |
| 17 | OPCODE(DemoteToHelperInvocation, Void, Label, ) | 18 | OPCODE(DemoteToHelperInvocation, Void, Label, ) |
| 18 | 19 | ||
diff --git a/src/shader_recompiler/frontend/maxwell/program.cpp b/src/shader_recompiler/frontend/maxwell/program.cpp index aee96eae3..59897cb3e 100644 --- a/src/shader_recompiler/frontend/maxwell/program.cpp +++ b/src/shader_recompiler/frontend/maxwell/program.cpp | |||
| @@ -150,4 +150,32 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo | |||
| 150 | return program; | 150 | return program; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b, | ||
| 154 | Environment& env2) { | ||
| 155 | IR::Program program{}; | ||
| 156 | Optimization::VertexATransformPass(vertex_a); | ||
| 157 | Optimization::VertexBTransformPass(vertex_b); | ||
| 158 | program.blocks.swap(vertex_a.blocks); | ||
| 159 | for (IR::Block* block : vertex_b.blocks) { | ||
| 160 | program.blocks.push_back(block); | ||
| 161 | } | ||
| 162 | program.stage = Stage::VertexB; | ||
| 163 | program.info = vertex_a.info; | ||
| 164 | program.local_memory_size = std::max(vertex_a.local_memory_size, vertex_b.local_memory_size); | ||
| 165 | |||
| 166 | for (size_t index = 0; index < 32; index++) { | ||
| 167 | program.info.input_generics[index].used |= vertex_b.info.input_generics[index].used; | ||
| 168 | program.info.stores_generics[index] |= vertex_b.info.stores_generics[index]; | ||
| 169 | } | ||
| 170 | Optimization::JoinTextureInfo(program.info, vertex_b.info); | ||
| 171 | Optimization::JoinStorageInfo(program.info, vertex_b.info); | ||
| 172 | Optimization::DualVertexJoinPass(program); | ||
| 173 | program.post_order_blocks = PostOrder(program.blocks); | ||
| 174 | Optimization::DeadCodeEliminationPass(program); | ||
| 175 | Optimization::IdentityRemovalPass(program); | ||
| 176 | Optimization::VerificationPass(program); | ||
| 177 | Optimization::CollectShaderInfoPass(env2, program); | ||
| 178 | return program; | ||
| 179 | } | ||
| 180 | |||
| 153 | } // namespace Shader::Maxwell | 181 | } // namespace Shader::Maxwell |
diff --git a/src/shader_recompiler/frontend/maxwell/program.h b/src/shader_recompiler/frontend/maxwell/program.h index 542621a1d..6e5d5ddd0 100644 --- a/src/shader_recompiler/frontend/maxwell/program.h +++ b/src/shader_recompiler/frontend/maxwell/program.h | |||
| @@ -21,4 +21,6 @@ namespace Shader::Maxwell { | |||
| 21 | ObjectPool<IR::Block>& block_pool, Environment& env, | 21 | ObjectPool<IR::Block>& block_pool, Environment& env, |
| 22 | Flow::CFG& cfg); | 22 | Flow::CFG& cfg); |
| 23 | 23 | ||
| 24 | [[nodiscard]] IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b, | ||
| 25 | Environment& env_vertex_b); | ||
| 24 | } // namespace Shader::Maxwell | 26 | } // namespace Shader::Maxwell |