Correct double immediate

This commit is contained in:
gdkchan 2020-03-02 00:35:07 -03:00
parent 0bc9a2641b
commit bccd6ec41f
3 changed files with 33 additions and 3 deletions

View file

@ -54,5 +54,21 @@ namespace Ryujinx.Graphics.Shader.Decoders
return BitConverter.Int32BitsToSingle(imm);
}
public static float DecodeD20Immediate(long opCode)
{
long imm = opCode.Extract(20, 19);
bool negate = opCode.Extract(56);
imm <<= 44;
if (negate)
{
imm |= 1 << 63;
}
return (float)BitConverter.Int64BitsToDouble(imm);
}
}
}

View file

@ -0,0 +1,14 @@
using Ryujinx.Graphics.Shader.Instructions;
namespace Ryujinx.Graphics.Shader.Decoders
{
class OpCodeDArithImm : OpCodeFArith, IOpCodeImmF
{
public float Immediate { get; }
public OpCodeDArithImm(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
{
Immediate = DecoderHelper.DecodeD20Immediate(opCode);
}
}
}

View file

@ -46,14 +46,14 @@ namespace Ryujinx.Graphics.Shader.Decoders
Set("111000100101xx", InstEmit.Brx, typeof(OpCodeBranchIndir));
Set("0101000010100x", InstEmit.Csetp, typeof(OpCodePset));
Set("0100110001110x", InstEmit.Dadd, typeof(OpCodeFArithCbuf));
Set("0011100x01110x", InstEmit.Dadd, typeof(OpCodeFArithImm));
Set("0011100x01110x", InstEmit.Dadd, typeof(OpCodeDArithImm));
Set("0101110001110x", InstEmit.Dadd, typeof(OpCodeFArithReg));
Set("010010110111xx", InstEmit.Dfma, typeof(OpCodeFArithCbuf));
Set("0011011x0111xx", InstEmit.Dfma, typeof(OpCodeFArithImm));
Set("0011011x0111xx", InstEmit.Dfma, typeof(OpCodeDArithImm));
Set("010100110111xx", InstEmit.Dfma, typeof(OpCodeFArithRegCbuf));
Set("010110110111xx", InstEmit.Dfma, typeof(OpCodeFArithReg));
Set("0100110010000x", InstEmit.Dmul, typeof(OpCodeFArithCbuf));
Set("0011100x10000x", InstEmit.Dmul, typeof(OpCodeFArithImm));
Set("0011100x10000x", InstEmit.Dmul, typeof(OpCodeDArithImm));
Set("0101110010000x", InstEmit.Dmul, typeof(OpCodeFArithReg));
Set("111000110000xx", InstEmit.Exit, typeof(OpCodeExit));
Set("0100110010101x", InstEmit.F2F, typeof(OpCodeFArithCbuf));