diff options
| author | 2021-03-26 16:02:04 +0100 | |
|---|---|---|
| committer | 2021-07-22 21:51:24 -0400 | |
| 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.gz yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.xz yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.zip | |
shader: Implement TLD4.PTP
Diffstat (limited to 'src/shader_recompiler/ir_opt/constant_propagation_pass.cpp')
| -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) { | |||
| 355 | } | 355 | } |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | void FoldConstantComposite(IR::Inst& inst, size_t amount = 2) { | ||
| 359 | for (size_t i = 0; i < amount; i++) { | ||
| 360 | if (!inst.Arg(i).IsConstantContainer()) { | ||
| 361 | return; | ||
| 362 | } | ||
| 363 | } | ||
| 364 | auto info{inst.Flags<IR::CompositeDecoration>()}; | ||
| 365 | info.is_constant = true; | ||
| 366 | inst.SetFlags(info); | ||
| 367 | } | ||
| 368 | |||
| 358 | void ConstantPropagation(IR::Block& block, IR::Inst& inst) { | 369 | void ConstantPropagation(IR::Block& block, IR::Inst& inst) { |
| 359 | switch (inst.Opcode()) { | 370 | switch (inst.Opcode()) { |
| 360 | case IR::Opcode::GetRegister: | 371 | case IR::Opcode::GetRegister: |
| @@ -380,6 +391,13 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) { | |||
| 380 | case IR::Opcode::SelectF32: | 391 | case IR::Opcode::SelectF32: |
| 381 | case IR::Opcode::SelectF64: | 392 | case IR::Opcode::SelectF64: |
| 382 | return FoldSelect(inst); | 393 | return FoldSelect(inst); |
| 394 | case IR::Opcode::CompositeConstructU32x2: | ||
| 395 | case IR::Opcode::CompositeConstructF16x2: | ||
| 396 | case IR::Opcode::CompositeConstructF32x2: | ||
| 397 | case IR::Opcode::CompositeConstructF64x2: | ||
| 398 | return FoldConstantComposite(inst, 2); | ||
| 399 | case IR::Opcode::CompositeConstructArrayU32x2: | ||
| 400 | return FoldConstantComposite(inst, 4); | ||
| 383 | case IR::Opcode::FPMul32: | 401 | case IR::Opcode::FPMul32: |
| 384 | return FoldFPMul32(inst); | 402 | return FoldFPMul32(inst); |
| 385 | case IR::Opcode::LogicalAnd: | 403 | case IR::Opcode::LogicalAnd: |