summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
diff options
context:
space:
mode:
authorGravatar FernandoS272021-04-17 12:51:43 +0200
committerGravatar ameerj2021-07-22 21:51:28 -0400
commit080857b60e78836901cf6e9601f48613812fcd04 (patch)
treeef466d23ba86a14f01abaa7b01acd7a7d6b24aa7 /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
parentshader: Implement fine derivates constant propagation (diff)
downloadyuzu-080857b60e78836901cf6e9601f48613812fcd04.tar.gz
yuzu-080857b60e78836901cf6e9601f48613812fcd04.tar.xz
yuzu-080857b60e78836901cf6e9601f48613812fcd04.zip
shader: Add coarse derivatives
Diffstat (limited to 'src/shader_recompiler/ir_opt/constant_propagation_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/constant_propagation_pass.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
index 983fb20ab..7e86f64a8 100644
--- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
+++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
@@ -428,19 +428,15 @@ void FoldFSwizzleAdd(IR::Block& block, IR::Inst& inst) {
428 if (!swizzle.IsImmediate()) { 428 if (!swizzle.IsImmediate()) {
429 return; 429 return;
430 } 430 }
431
432 const IR::Value value_1{GetThroughCast(inst.Arg(0).Resolve(), IR::Opcode::BitCastF32U32)}; 431 const IR::Value value_1{GetThroughCast(inst.Arg(0).Resolve(), IR::Opcode::BitCastF32U32)};
433 const IR::Value value_2{GetThroughCast(inst.Arg(1).Resolve(), IR::Opcode::BitCastF32U32)}; 432 const IR::Value value_2{GetThroughCast(inst.Arg(1).Resolve(), IR::Opcode::BitCastF32U32)};
434
435 if (value_1.IsImmediate()) { 433 if (value_1.IsImmediate()) {
436 return; 434 return;
437 } 435 }
438
439 const u32 swizzle_value{swizzle.U32()}; 436 const u32 swizzle_value{swizzle.U32()};
440 if (swizzle_value != 0x99 && swizzle_value != 0xA5) { 437 if (swizzle_value != 0x99 && swizzle_value != 0xA5) {
441 return; 438 return;
442 } 439 }
443
444 IR::Inst* const inst2{value_1.InstRecursive()}; 440 IR::Inst* const inst2{value_1.InstRecursive()};
445 if (inst2->GetOpcode() != IR::Opcode::ShuffleButterfly) { 441 if (inst2->GetOpcode() != IR::Opcode::ShuffleButterfly) {
446 return; 442 return;
@@ -449,19 +445,15 @@ void FoldFSwizzleAdd(IR::Block& block, IR::Inst& inst) {
449 if (value_2 != value_3) { 445 if (value_2 != value_3) {
450 return; 446 return;
451 } 447 }
452
453 const IR::Value index{inst2->Arg(1)}; 448 const IR::Value index{inst2->Arg(1)};
454 const IR::Value clamp{inst2->Arg(2)}; 449 const IR::Value clamp{inst2->Arg(2)};
455 const IR::Value segmentation_mask{inst2->Arg(3)}; 450 const IR::Value segmentation_mask{inst2->Arg(3)};
456
457 if (!index.IsImmediate() || !clamp.IsImmediate() || !segmentation_mask.IsImmediate()) { 451 if (!index.IsImmediate() || !clamp.IsImmediate() || !segmentation_mask.IsImmediate()) {
458 return; 452 return;
459 } 453 }
460
461 if (clamp.U32() != 3 || segmentation_mask.U32() != 28) { 454 if (clamp.U32() != 3 || segmentation_mask.U32() != 28) {
462 return; 455 return;
463 } 456 }
464
465 if (swizzle_value == 0x99) { 457 if (swizzle_value == 0x99) {
466 // DPdxFine 458 // DPdxFine
467 if (index.U32() == 1) { 459 if (index.U32() == 1) {