aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/shader/decode/arithmetic.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-01-27 01:14:25 -0300
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-01-27 01:15:44 -0300
commit098218ff4c87854a61f44352f429f809098dd5eb (patch)
tree60f589d1c76bb589b9d171ae6e4ac2395288ed36 /src/video_core/shader/decode/arithmetic.cpp
parent53184a16ccaa62fc9aba6d18d447e4b646434fc1 (diff)
shader/arithmetic: Implement FCMP
Compares the third operand with zero, then selects between the first and second.
Diffstat (limited to 'src/video_core/shader/decode/arithmetic.cpp')
-rw-r--r--src/video_core/shader/decode/arithmetic.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/arithmetic.cpp b/src/video_core/shader/decode/arithmetic.cpp
index fcedd2af69..90240c7657 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) {
Node op_a = GetRegister(instr.gpr8);
- Node op_b = [&]() -> Node {
+ Node op_b = [&] {
if (instr.is_b_imm) {
return GetImmediate19(instr);
} else if (instr.is_b_gpr) {
@@ -141,6 +141,15 @@ u32 ShaderIR::DecodeArithmetic(NodeBlock& bb, u32 pc) {
SetRegister(bb, instr.gpr0, value);
break;
}
+ case OpCode::Id::FCMP_R: {
+ UNIMPLEMENTED_IF(instr.fcmp.ftz == 0);
+ Node op_c = GetRegister(instr.gpr39);
+ Node comp = GetPredicateComparisonFloat(instr.fcmp.cond, std::move(op_c), Immediate(0.0f));
+ SetRegister(
+ bb, instr.gpr0,
+ Operation(OperationCode::Select, std::move(comp), std::move(op_a), std::move(op_b)));
+ break;
+ }
case OpCode::Id::RRO_C:
case OpCode::Id::RRO_R:
case OpCode::Id::RRO_IMM: {