Update the Controller Support Fork

This commit is contained in:
John Clemis 2018-06-29 07:37:55 -05:00 committed by GitHub
commit e0c87aa6f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 69 additions and 7 deletions

View file

@ -271,6 +271,7 @@ namespace ChocolArm64
SetA64("000111100x1xxxxx010110xxxxxxxxxx", AInstEmit.Fmin_S, typeof(AOpCodeSimdReg));
SetA64("0x0011101x1xxxxx111101xxxxxxxxxx", AInstEmit.Fmin_V, typeof(AOpCodeSimdReg));
SetA64("000111100x1xxxxx011110xxxxxxxxxx", AInstEmit.Fminnm_S, typeof(AOpCodeSimdReg));
SetA64("010111111<<xxxxx0001x0xxxxxxxxxx", AInstEmit.Fmla_Se, typeof(AOpCodeSimdRegElemF));
SetA64("0>0011100<1xxxxx110011xxxxxxxxxx", AInstEmit.Fmla_V, typeof(AOpCodeSimdReg));
SetA64("0x0011111<<xxxxx0001x0xxxxxxxxxx", AInstEmit.Fmla_Ve, typeof(AOpCodeSimdRegElemF));
SetA64("0>0011101<1xxxxx110011xxxxxxxxxx", AInstEmit.Fmls_V, typeof(AOpCodeSimdReg));

View file

@ -516,6 +516,15 @@ namespace ChocolArm64.Instruction
Fmin_S(Context);
}
public static void Fmla_Se(AILEmitterCtx Context)
{
EmitScalarTernaryOpByElemF(Context, () =>
{
Context.Emit(OpCodes.Mul);
Context.Emit(OpCodes.Add);
});
}
public static void Fmla_V(AILEmitterCtx Context)
{
EmitVectorTernaryOpF(Context, () =>

View file

@ -260,6 +260,13 @@ namespace ChocolArm64.Instruction
EmitScalarOpByElemF(Context, Emit, Op.Index, Ternary: false);
}
public static void EmitScalarTernaryOpByElemF(AILEmitterCtx Context, Action Emit)
{
AOpCodeSimdRegElemF Op = (AOpCodeSimdRegElemF)Context.CurrOp;
EmitScalarOpByElemF(Context, Emit, Op.Index, Ternary: true);
}
public static void EmitScalarOpByElemF(AILEmitterCtx Context, Action Emit, int Elem, bool Ternary)
{
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;

View file

@ -422,6 +422,15 @@ namespace ChocolArm64.Instruction
{
return Sse41.Extract(Vector, Index);
}
else if (Sse2.IsSupported)
{
Vector128<ushort> ShortVector = Sse.StaticCast<float, ushort>(Vector);
int Low = Sse2.Extract(ShortVector, (byte)(Index * 2 + 0));
int High = Sse2.Extract(ShortVector, (byte)(Index * 2 + 1));
return BitConverter.Int32BitsToSingle(Low | (High << 16));
}
throw new PlatformNotSupportedException();
}
@ -509,6 +518,20 @@ namespace ChocolArm64.Instruction
{
return Sse41.Insert(Vector, Value, (byte)(Index << 4));
}
else if (Sse2.IsSupported)
{
int IntValue = BitConverter.SingleToInt32Bits(Value);
ushort Low = (ushort)(IntValue >> 0);
ushort High = (ushort)(IntValue >> 16);
Vector128<ushort> ShortVector = Sse.StaticCast<float, ushort>(Vector);
ShortVector = Sse2.Insert(ShortVector, Low, (byte)(Index * 2 + 0));
ShortVector = Sse2.Insert(ShortVector, High, (byte)(Index * 2 + 1));
return Sse.StaticCast<ushort, float>(ShortVector);
}
throw new PlatformNotSupportedException();
}

View file

@ -28,6 +28,6 @@ namespace Ryujinx.Graphics.Gal
void DrawArrays(int First, int PrimCount, GalPrimitiveType PrimType);
void DrawElements(long IboKey, int First, GalPrimitiveType PrimType);
void DrawElements(long IboKey, int First, int VertexBase, GalPrimitiveType PrimType);
}
}

View file

@ -54,6 +54,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
private struct IbInfo
{
public int Count;
public int ElemSizeLog2;
public DrawElementsType Type;
}
@ -206,6 +207,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
IndexBuffer.Type = OGLEnumConverter.GetDrawElementsType(Format);
IndexBuffer.Count = Size >> (int)Format;
IndexBuffer.ElemSizeLog2 = (int)Format;
}
public void DrawArrays(int First, int PrimCount, GalPrimitiveType PrimType)
@ -220,7 +223,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.DrawArrays(OGLEnumConverter.GetPrimitiveType(PrimType), First, PrimCount);
}
public void DrawElements(long IboKey, int First, GalPrimitiveType PrimType)
public void DrawElements(long IboKey, int First, int VertexBase, GalPrimitiveType PrimType)
{
if (!IboCache.TryGetValue(IboKey, out int IboHandle))
{
@ -233,7 +236,18 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.BindBuffer(BufferTarget.ElementArrayBuffer, IboHandle);
GL.DrawElements(Mode, IndexBuffer.Count, IndexBuffer.Type, First);
First <<= IndexBuffer.ElemSizeLog2;
if (VertexBase != 0)
{
IntPtr Indices = new IntPtr(First);
GL.DrawElementsBaseVertex(Mode, IndexBuffer.Count, IndexBuffer.Type, Indices, VertexBase);
}
else
{
GL.DrawElements(Mode, IndexBuffer.Count, IndexBuffer.Type, First);
}
}
}
}

View file

@ -15,6 +15,8 @@ namespace Ryujinx.Graphics.Gal.Shader
public const int GlPositionVec4Index = 7;
public const int PositionOutAttrLocation = 15;
private const int AttrStartIndex = 8;
private const int TexStartIndex = 8;

View file

@ -208,7 +208,7 @@ namespace Ryujinx.Graphics.Gal.Shader
{
if (Decl.ShaderType == GalShaderType.Fragment)
{
SB.AppendLine("in vec4 " + GlslDecl.PositionOutAttrName + ";");
SB.AppendLine("layout (location = " + GlslDecl.PositionOutAttrLocation + ") in vec4 " + GlslDecl.PositionOutAttrName + ";");
}
PrintDeclAttributes(Decl.InAttributes.Values, "in");
@ -218,7 +218,7 @@ namespace Ryujinx.Graphics.Gal.Shader
{
if (Decl.ShaderType == GalShaderType.Vertex)
{
SB.AppendLine("out vec4 " + GlslDecl.PositionOutAttrName + ";");
SB.AppendLine("layout (location = " + GlslDecl.PositionOutAttrLocation + ") out vec4 " + GlslDecl.PositionOutAttrName + ";");
}
PrintDeclAttributes(Decl.OutAttributes.Values, "out");

View file

@ -487,7 +487,9 @@ namespace Ryujinx.HLE.Gpu.Engines
if (IndexCount != 0)
{
Gpu.Renderer.Rasterizer.DrawElements(IndexPosition, IndexFirst, PrimType);
int VertexBase = ReadRegister(NvGpuEngine3dReg.VertexArrayElemBase);
Gpu.Renderer.Rasterizer.DrawElements(IndexPosition, IndexFirst, VertexBase, PrimType);
}
else
{

View file

@ -8,6 +8,7 @@ using Ryujinx.HLE.OsHle.Services.Friend;
using Ryujinx.HLE.OsHle.Services.FspSrv;
using Ryujinx.HLE.OsHle.Services.Hid;
using Ryujinx.HLE.OsHle.Services.Lm;
using Ryujinx.HLE.OsHle.Services.Mm;
using Ryujinx.HLE.OsHle.Services.Nfp;
using Ryujinx.HLE.OsHle.Services.Ns;
using Ryujinx.HLE.OsHle.Services.Nv;
@ -80,6 +81,9 @@ namespace Ryujinx.HLE.OsHle.Services
case "lm":
return new ILogService();
case "mm:u":
return new IRequest();
case "nfp:user":
return new IUserManager();