Replace void* param in IGL.BindArrayData w/ IntPtr

This commit is contained in:
YoshiRulz 2021-04-08 14:16:35 +10:00
parent 3db06c4aa9
commit 214f024d86
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
6 changed files with 12 additions and 20 deletions

View File

@ -87,7 +87,7 @@ namespace BizHawk.Bizware.BizwareGL
/// <summary>
/// Binds array data for use with the currently-bound pipeline's VertexLayout
/// </summary>
unsafe void BindArrayData(void* pData);
void BindArrayData(IntPtr pData);
/// <summary>
/// Begins a rendering scene; use before doing any draw calls, as per normal

View File

@ -122,7 +122,7 @@ namespace BizHawk.Bizware.BizwareGL
pData[i++] = 1; pData[i++] = v1;
Owner.SetBlendState(Owner.BlendNoneCopy);
Owner.BindArrayData(pData);
Owner.BindArrayData(new(pData));
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
}

View File

@ -951,10 +951,7 @@ namespace BizHawk.Bizware.DirectX
Dev.DrawUserPrimitives(pt, primCount, (void*)ptr, (uint)stride);
}
public unsafe void BindArrayData(void* pData)
{
_pVertexData = new IntPtr(pData);
}
public void BindArrayData(IntPtr pData) => _pVertexData = pData;
public void BeginScene()
{

View File

@ -253,7 +253,7 @@ namespace BizHawk.Bizware.OpenTK3
fixed (float* pData = &data[0])
{
Owner.BindArrayData(pData);
Owner.BindArrayData(new(pData));
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
}
}
@ -322,7 +322,7 @@ namespace BizHawk.Bizware.OpenTK3
pData[30] = CornerColors[3].Z;
pData[31] = CornerColors[3].W;
Owner.BindArrayData(pData);
Owner.BindArrayData(new(pData));
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
#if DEBUG

View File

@ -386,10 +386,7 @@ namespace BizHawk.Bizware.OpenTK3
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, mode);
}
public unsafe void BindArrayData(void* pData)
{
MyBindArrayData(sStatePendingVertexLayout, pData);
}
public void BindArrayData(IntPtr pData) => MyBindArrayData(sStatePendingVertexLayout, pData);
public void DrawArrays(BizGL.PrimitiveType mode, int first, int count)
{
@ -749,7 +746,7 @@ namespace BizHawk.Bizware.OpenTK3
currBindings.Clear();
}
private unsafe void MyBindArrayData(VertexLayout layout, void* pData)
private void MyBindArrayData(VertexLayout layout, IntPtr pData)
{
UnbindVertexAttributes();
@ -781,7 +778,7 @@ namespace BizHawk.Bizware.OpenTK3
(VertexAttribPointerType) (int) kvp.Value.AttribType, // these are the same enum
kvp.Value.Normalized,
kvp.Value.Stride,
new IntPtr(pData) + kvp.Value.Offset);
pData + kvp.Value.Offset);
GL.EnableVertexAttribArray(kvp.Key);
currBindings.Add(kvp.Key);
}
@ -795,17 +792,17 @@ namespace BizHawk.Bizware.OpenTK3
{
case AttribUsage.Position:
GL.EnableClientState(ArrayCap.VertexArray);
GL.VertexPointer(kvp.Value.Components,VertexPointerType.Float,kvp.Value.Stride,new IntPtr(pData) + kvp.Value.Offset);
GL.VertexPointer(kvp.Value.Components,VertexPointerType.Float,kvp.Value.Stride,pData + kvp.Value.Offset);
break;
case AttribUsage.Texcoord0:
GL.ClientActiveTexture(TextureUnit.Texture0);
GL.EnableClientState(ArrayCap.TextureCoordArray);
GL.TexCoordPointer(kvp.Value.Components, TexCoordPointerType.Float, kvp.Value.Stride, new IntPtr(pData) + kvp.Value.Offset);
GL.TexCoordPointer(kvp.Value.Components, TexCoordPointerType.Float, kvp.Value.Stride, pData + kvp.Value.Offset);
break;
case AttribUsage.Texcoord1:
GL.ClientActiveTexture(TextureUnit.Texture1);
GL.EnableClientState(ArrayCap.TextureCoordArray);
GL.TexCoordPointer(kvp.Value.Components, TexCoordPointerType.Float, kvp.Value.Stride, new IntPtr(pData) + kvp.Value.Offset);
GL.TexCoordPointer(kvp.Value.Components, TexCoordPointerType.Float, kvp.Value.Stride, pData + kvp.Value.Offset);
GL.ClientActiveTexture(TextureUnit.Texture0);
break;
case AttribUsage.Color0:

View File

@ -47,9 +47,7 @@ namespace BizHawk.Client.EmuHawk
_currentClearColor = color;
}
public unsafe void BindArrayData(void* pData)
{
}
public void BindArrayData(IntPtr pData) {}
public void FreeTexture(Texture2d tex)
{