Implement FCMP shader instruction (#1067)

This commit is contained in:
gdkchan 2020-03-30 07:04:00 -03:00 committed by GitHub
parent 9948a7be53
commit d599fba711
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -90,6 +90,10 @@ namespace Ryujinx.Graphics.Shader.Decoders
Set("0011100x01011x", InstEmit.Fadd, typeof(OpCodeFArithImm)); Set("0011100x01011x", InstEmit.Fadd, typeof(OpCodeFArithImm));
Set("000010xxxxxxxx", InstEmit.Fadd, typeof(OpCodeFArithImm32)); Set("000010xxxxxxxx", InstEmit.Fadd, typeof(OpCodeFArithImm32));
Set("0101110001011x", InstEmit.Fadd, typeof(OpCodeFArithReg)); Set("0101110001011x", InstEmit.Fadd, typeof(OpCodeFArithReg));
Set("010010111010xx", InstEmit.Fcmp, typeof(OpCodeFArithCbuf));
Set("0011011x1010xx", InstEmit.Fcmp, typeof(OpCodeFArithImm));
Set("010110111010xx", InstEmit.Fcmp, typeof(OpCodeFArithReg));
Set("010100111010xx", InstEmit.Fcmp, typeof(OpCodeFArithRegCbuf));
Set("010010011xxxxx", InstEmit.Ffma, typeof(OpCodeFArithCbuf)); Set("010010011xxxxx", InstEmit.Ffma, typeof(OpCodeFArithCbuf));
Set("0011001x1xxxxx", InstEmit.Ffma, typeof(OpCodeFArithImm)); Set("0011001x1xxxxx", InstEmit.Ffma, typeof(OpCodeFArithImm));
Set("000011xxxxxxxx", InstEmit.Ffma32i, typeof(OpCodeFArithImm32)); Set("000011xxxxxxxx", InstEmit.Ffma32i, typeof(OpCodeFArithImm32));

View file

@ -16,6 +16,24 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void Dmul(EmitterContext context) => EmitFPMultiply(context, Instruction.FP64); public static void Dmul(EmitterContext context) => EmitFPMultiply(context, Instruction.FP64);
public static void Fadd(EmitterContext context) => EmitFPAdd(context, Instruction.FP32); 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 Ffma(EmitterContext context) => EmitFPFma(context, Instruction.FP32);
public static void Ffma32i(EmitterContext context) public static void Ffma32i(EmitterContext context)