diff options
author | FernandoS27 <fsahmkow27@gmail.com> | 2021-03-26 16:02:04 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:24 +0200 |
commit | 742d11c2ad948c8630be15901514ec9e5e5fcd20 (patch) | |
tree | 4d9e0976f8c95fbb5c8006b46579200315b04f0f /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp | |
parent | shader: Fix Array Indices in TEX/TLD4 (diff) | |
download | yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.gz yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.bz2 yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.lz yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.xz yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.zst yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.zip |
Diffstat (limited to '')
-rw-r--r-- | src/shader_recompiler/ir_opt/constant_propagation_pass.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp index 28060dccf..12159e738 100644 --- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp +++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp @@ -355,6 +355,17 @@ void FoldBranchConditional(IR::Inst& inst) { } } +void FoldConstantComposite(IR::Inst& inst, size_t amount = 2) { + for (size_t i = 0; i < amount; i++) { + if (!inst.Arg(i).IsConstantContainer()) { + return; + } + } + auto info{inst.Flags<IR::CompositeDecoration>()}; + info.is_constant = true; + inst.SetFlags(info); +} + void ConstantPropagation(IR::Block& block, IR::Inst& inst) { switch (inst.Opcode()) { case IR::Opcode::GetRegister: @@ -380,6 +391,13 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) { case IR::Opcode::SelectF32: case IR::Opcode::SelectF64: return FoldSelect(inst); + case IR::Opcode::CompositeConstructU32x2: + case IR::Opcode::CompositeConstructF16x2: + case IR::Opcode::CompositeConstructF32x2: + case IR::Opcode::CompositeConstructF64x2: + return FoldConstantComposite(inst, 2); + case IR::Opcode::CompositeConstructArrayU32x2: + return FoldConstantComposite(inst, 4); case IR::Opcode::FPMul32: return FoldFPMul32(inst); case IR::Opcode::LogicalAnd: |