aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-03-30 07:04:00 -0300
committerGitHub <noreply@github.com>2020-03-30 12:04:00 +0200
commitd599fba711146e2b92a1fc6be19b0f5f83abab58 (patch)
tree7239a5281fd40288c3d8ed83c5031ff2d36628ec /Ryujinx.Graphics.Shader/Instructions
parent9948a7be53a9846b9de493653aa76819ff1b9bd3 (diff)
Implement FCMP shader instruction (#1067)
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs
index fa5c684c..c171a986 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs
@@ -16,6 +16,24 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void Dmul(EmitterContext context) => EmitFPMultiply(context, Instruction.FP64);
public static void Fadd(EmitterContext context) => EmitFPAdd(context, Instruction.FP32);
+
+ public static void Fcmp(EmitterContext context)
+ {
+ OpCode op = context.CurrOp;
+
+ Condition cmpOp = (Condition)op.RawOpCode.Extract(48, 4);
+
+ Operand srcA = GetSrcA(context);
+ Operand srcB = GetSrcB(context);
+ Operand srcC = GetSrcC(context);
+
+ Operand cmpRes = GetFPComparison(context, cmpOp, srcC, ConstF(0));
+
+ Operand res = context.ConditionalSelect(cmpRes, srcA, srcB);
+
+ context.Copy(GetDest(context), res);
+ }
+
public static void Ffma(EmitterContext context) => EmitFPFma(context, Instruction.FP32);
public static void Ffma32i(EmitterContext context)