From 0c9a88cce7fe819ebb8e97639ae5f25ecec17960 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 8 Apr 2018 01:46:06 -0300 Subject: [PATCH] [GPU] Fix decoding of negative 19-bits immediates on shader, other tweaks --- ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs | 10 ++++++---- Ryujinx.Graphics/Gal/Shader/ShaderDecodeHelper.cs | 4 ++-- Ryujinx.Graphics/Gpu/NvGpuFifo.cs | 5 ----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs index 0faca47273..0b94554d59 100644 --- a/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs +++ b/ChocolArm64/Instruction/AInstEmitSimdArithmetic.cs @@ -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(); diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeHelper.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeHelper.cs index 035b957df6..7989570dd3 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeHelper.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeHelper.cs @@ -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); diff --git a/Ryujinx.Graphics/Gpu/NvGpuFifo.cs b/Ryujinx.Graphics/Gpu/NvGpuFifo.cs index 0ae499b4db..df765895c4 100644 --- a/Ryujinx.Graphics/Gpu/NvGpuFifo.cs +++ b/Ryujinx.Graphics/Gpu/NvGpuFifo.cs @@ -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"); - } } }