Fix some stack overflows

This commit is contained in:
IsaacMarovitz 2024-05-09 22:15:55 -04:00
parent e584f8d37d
commit e72bf35c03
No known key found for this signature in database
GPG key ID: 7B138C0A9A1D297E
2 changed files with 21 additions and 28 deletions

View file

@ -103,14 +103,7 @@ namespace Ryujinx.Graphics.OpenGL
public static void SetData(GL api, BufferHandle buffer, int offset, ReadOnlySpan<byte> data)
{
api.BindBuffer(BufferTargetARB.CopyWriteBuffer, buffer.ToUInt32());
unsafe
{
fixed (byte* ptr = data)
{
api.BufferSubData(BufferTargetARB.CopyWriteBuffer, offset, (uint)data.Length, (IntPtr)ptr);
}
}
api.BufferSubData(BufferTargetARB.CopyWriteBuffer, offset, (uint)data.Length, data);
}
public static void Delete(GL api, BufferHandle buffer)

View file

@ -554,7 +554,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
return data;
}
private void ReadFrom2D(IntPtr data, int layer, int level, int x, int y, int width, int height, int mipSize)
private unsafe void ReadFrom2D(IntPtr data, int layer, int level, int x, int y, int width, int height, int mipSize)
{
TextureTarget target = Target.Convert();
@ -574,7 +574,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
(uint)width,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -585,7 +585,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
(uint)width,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -601,7 +601,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
1,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -614,7 +614,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
1,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -630,7 +630,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
(uint)height,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -643,7 +643,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
(uint)height,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -663,7 +663,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
1,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -678,7 +678,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
1,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -694,7 +694,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
(uint)height,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -707,13 +707,13 @@ namespace Ryujinx.Graphics.OpenGL.Image
(uint)height,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
}
}
private void ReadFrom(IntPtr data, int size)
private unsafe void ReadFrom(IntPtr data, int size)
{
TextureTarget target = Target.Convert();
uint baseLevel = 0;
@ -762,7 +762,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
width,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -773,7 +773,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
width,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -790,7 +790,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
height,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -803,7 +803,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
height,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -823,7 +823,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
depth,
(InternalFormat)format.PixelFormat,
(uint)mipSize,
data);
(void*)data);
}
else
{
@ -838,7 +838,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
depth,
format.PixelFormat,
format.PixelType,
data);
(void*)data);
}
break;
@ -858,7 +858,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
height,
(InternalFormat)format.PixelFormat,
(uint)mipSize / 6,
data + faceOffset);
(void*)(data + faceOffset));
}
else
{
@ -871,7 +871,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
height,
format.PixelFormat,
format.PixelType,
data + faceOffset);
(void*)(data + faceOffset));
}
}
break;