summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2020-02-04 11:36:59 -0500
committerGravatar GitHub2020-02-04 11:36:59 -0500
commitbf21aacc7412c930da21e36850f24e97c3f103f6 (patch)
treee6bf9646156c8041dff2759e66b0fd0b6856c1b4
parentMerge pull request #3360 from CJBok/statusbar-buttons (diff)
parentshader/arithmetic: Implement FCMP (diff)
downloadyuzu-bf21aacc7412c930da21e36850f24e97c3f103f6.tar.gz
yuzu-bf21aacc7412c930da21e36850f24e97c3f103f6.tar.xz
yuzu-bf21aacc7412c930da21e36850f24e97c3f103f6.zip
Merge pull request #3356 from ReinUsesLisp/fcmp
shader/arithmetic: Implement FCMP
Diffstat (limited to '')
-rw-r--r--src/video_core/engines/shader_bytecode.h7
-rw-r--r--src/video_core/shader/decode/arithmetic.cpp11
2 files changed, 17 insertions, 1 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index f443ec0fe..cbb201114 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -1124,6 +1124,11 @@ union Instruction {
1124 } fset; 1124 } fset;
1125 1125
1126 union { 1126 union {
1127 BitField<47, 1, u64> ftz;
1128 BitField<48, 4, PredCondition> cond;
1129 } fcmp;
1130
1131 union {
1127 BitField<49, 1, u64> bf; 1132 BitField<49, 1, u64> bf;
1128 BitField<35, 3, PredCondition> cond; 1133 BitField<35, 3, PredCondition> cond;
1129 BitField<50, 1, u64> ftz; 1134 BitField<50, 1, u64> ftz;
@@ -1800,6 +1805,7 @@ public:
1800 ICMP_R, 1805 ICMP_R,
1801 ICMP_CR, 1806 ICMP_CR,
1802 ICMP_IMM, 1807 ICMP_IMM,
1808 FCMP_R,
1803 MUFU, // Multi-Function Operator 1809 MUFU, // Multi-Function Operator
1804 RRO_C, // Range Reduction Operator 1810 RRO_C, // Range Reduction Operator
1805 RRO_R, 1811 RRO_R,
@@ -2104,6 +2110,7 @@ private:
2104 INST("0101110100100---", Id::HSETP2_R, Type::HalfSetPredicate, "HSETP2_R"), 2110 INST("0101110100100---", Id::HSETP2_R, Type::HalfSetPredicate, "HSETP2_R"),
2105 INST("0111111-0-------", Id::HSETP2_IMM, Type::HalfSetPredicate, "HSETP2_IMM"), 2111 INST("0111111-0-------", Id::HSETP2_IMM, Type::HalfSetPredicate, "HSETP2_IMM"),
2106 INST("0101110100011---", Id::HSET2_R, Type::HalfSet, "HSET2_R"), 2112 INST("0101110100011---", Id::HSET2_R, Type::HalfSet, "HSET2_R"),
2113 INST("010110111010----", Id::FCMP_R, Type::Arithmetic, "FCMP_R"),
2107 INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"), 2114 INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"),
2108 INST("0100110010010---", Id::RRO_C, Type::Arithmetic, "RRO_C"), 2115 INST("0100110010010---", Id::RRO_C, Type::Arithmetic, "RRO_C"),
2109 INST("0101110010010---", Id::RRO_R, Type::Arithmetic, "RRO_R"), 2116 INST("0101110010010---", Id::RRO_R, Type::Arithmetic, "RRO_R"),
diff --git a/src/video_core/shader/decode/arithmetic.cpp b/src/video_core/shader/decode/arithmetic.cpp
index fcedd2af6..90240c765 100644
--- a/src/video_core/shader/decode/arithmetic.cpp
+++ b/src/video_core/shader/decode/arithmetic.cpp
@@ -21,7 +21,7 @@ u32 ShaderIR::DecodeArithmetic(NodeBlock& bb, u32 pc) {
21 21
22 Node op_a = GetRegister(instr.gpr8); 22 Node op_a = GetRegister(instr.gpr8);
23 23
24 Node op_b = [&]() -> Node { 24 Node op_b = [&] {
25 if (instr.is_b_imm) { 25 if (instr.is_b_imm) {
26 return GetImmediate19(instr); 26 return GetImmediate19(instr);
27 } else if (instr.is_b_gpr) { 27 } else if (instr.is_b_gpr) {
@@ -141,6 +141,15 @@ u32 ShaderIR::DecodeArithmetic(NodeBlock& bb, u32 pc) {
141 SetRegister(bb, instr.gpr0, value); 141 SetRegister(bb, instr.gpr0, value);
142 break; 142 break;
143 } 143 }
144 case OpCode::Id::FCMP_R: {
145 UNIMPLEMENTED_IF(instr.fcmp.ftz == 0);
146 Node op_c = GetRegister(instr.gpr39);
147 Node comp = GetPredicateComparisonFloat(instr.fcmp.cond, std::move(op_c), Immediate(0.0f));
148 SetRegister(
149 bb, instr.gpr0,
150 Operation(OperationCode::Select, std::move(comp), std::move(op_a), std::move(op_b)));
151 break;
152 }
144 case OpCode::Id::RRO_C: 153 case OpCode::Id::RRO_C:
145 case OpCode::Id::RRO_R: 154 case OpCode::Id::RRO_R:
146 case OpCode::Id::RRO_IMM: { 155 case OpCode::Id::RRO_IMM: {