Quads, QuadStrip, const attributes and half-float attributes support (#447)
* Quads, QuadStrip and const attributes support * Add support for half float attributes and fix texture pitch alignment * Throw when an unsupported float type is used as const attribute aswell
This commit is contained in:
parent
dd3cb33c9f
commit
aa1cd849cf
12 changed files with 420 additions and 53 deletions
|
@ -119,6 +119,18 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
GL.BufferData(BufferTarget.ElementArrayBuffer, Length, HostAddress, BufferUsageHint.StreamDraw);
|
||||
}
|
||||
|
||||
public void CreateIbo(long Key, int DataSize, byte[] Buffer)
|
||||
{
|
||||
int Handle = GL.GenBuffer();
|
||||
|
||||
IboCache.AddOrUpdate(Key, Handle, (uint)DataSize);
|
||||
|
||||
IntPtr Length = new IntPtr(Buffer.Length);
|
||||
|
||||
GL.BindBuffer(BufferTarget.ElementArrayBuffer, Handle);
|
||||
GL.BufferData(BufferTarget.ElementArrayBuffer, Length, Buffer, BufferUsageHint.StreamDraw);
|
||||
}
|
||||
|
||||
public void SetIndexArray(int Size, GalIndexFormat Format)
|
||||
{
|
||||
IndexBuffer.Type = OGLEnumConverter.GetDrawElementsType(Format);
|
||||
|
@ -135,7 +147,26 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
return;
|
||||
}
|
||||
|
||||
GL.DrawArrays(OGLEnumConverter.GetPrimitiveType(PrimType), First, Count);
|
||||
if (PrimType == GalPrimitiveType.Quads)
|
||||
{
|
||||
for (int Offset = 0; Offset < Count; Offset += 4)
|
||||
{
|
||||
GL.DrawArrays(PrimitiveType.TriangleFan, First + Offset, 4);
|
||||
}
|
||||
}
|
||||
else if (PrimType == GalPrimitiveType.QuadStrip)
|
||||
{
|
||||
GL.DrawArrays(PrimitiveType.TriangleFan, First, 4);
|
||||
|
||||
for (int Offset = 2; Offset < Count; Offset += 2)
|
||||
{
|
||||
GL.DrawArrays(PrimitiveType.TriangleFan, First + Offset, 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL.DrawArrays(OGLEnumConverter.GetPrimitiveType(PrimType), First, Count);
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawElements(long IboKey, int First, int VertexBase, GalPrimitiveType PrimType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue