Convert GetBinary

This commit is contained in:
Isaac Marovitz 2024-05-09 19:34:19 -04:00
parent 8df23211f6
commit a9d0dd3893
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1

View file

@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.OpenGL
{
fixed (byte* ptr = code)
{
_api.ProgramBinary(Handle, binaryFormat, (IntPtr)ptr, code.Length - 4);
_api.ProgramBinary(Handle, (GLEnum)binaryFormat, (IntPtr)ptr, (uint)code.Length - 4);
}
}
}
@ -138,17 +138,21 @@ namespace Ryujinx.Graphics.OpenGL
return _status;
}
public byte[] GetBinary()
public unsafe byte[] GetBinary()
{
_api.GetProgram(Handle, ProgramPropertyARB.ProgramBinaryLength, out int size);
byte[] data = new byte[size + 4];
Span<byte> data = stackalloc byte[size];
GLEnum binFormat;
_api.GetProgramBinary(Handle, (uint)size, out _, out GLEnum binFormat, data);
fixed (byte* ptr = data)
{
_api.GetProgramBinary(Handle, (uint)size, out _, out binFormat, ptr);
}
BinaryPrimitives.WriteInt32LittleEndian(data.AsSpan(size, 4), (int)binFormat);
BinaryPrimitives.WriteInt32LittleEndian(data, (int)binFormat);
return data;
return data.ToArray();
}
private void DeleteShaders()