[GPU] Fix decoding of negative 19-bits immediates on shader, other tweaks

This commit is contained in:
gdkchan 2018-04-08 01:46:06 -03:00
parent e26555608a
commit 0c9a88cce7
3 changed files with 8 additions and 11 deletions

View file

@ -133,21 +133,23 @@ namespace ChocolArm64.Instruction
{
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
int SizeF = Op.Size & 1;
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
int Elems = Bytes >> Op.Size;
int Elems = Bytes >> SizeF + 2;
int Half = Elems >> 1;
for (int Index = 0; Index < Elems; Index++)
{
int Elem = (Index & (Half - 1)) << 1;
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 0, Op.Size);
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 1, Op.Size);
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 0, SizeF);
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 1, SizeF);
Context.Emit(OpCodes.Add);
EmitVectorInsertTmpF(Context, Index, Op.Size);
EmitVectorInsertTmpF(Context, Index, SizeF);
}
Context.EmitLdvectmp();

View file

@ -62,13 +62,13 @@ namespace Ryujinx.Graphics.Gal.Shader
public static ShaderIrNode GetOperImm19_20(long OpCode)
{
uint Value = (uint)(OpCode >> 20) & 0x7ffff;
int Value = (int)(OpCode >> 20) & 0x7ffff;
bool Neg = ((OpCode >> 56) & 1) != 0;
if (Neg)
{
Value |= 0x80000000;
Value = -Value;
}
return new ShaderIrOperImm((int)Value);

View file

@ -141,11 +141,6 @@ namespace Ryujinx.Graphics.Gpu
{
case NvGpuEngine._3d: Call3dMethod(Memory, PBEntry); break;
}
if (PBEntry.SubChannel > 4)
{
throw new System.Exception("bad subch");
}
}
}