aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Buffer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Buffer.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Buffer.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Buffer.cs b/Ryujinx.Graphics.OpenGL/Buffer.cs
index e8fd9a6b..89216b83 100644
--- a/Ryujinx.Graphics.OpenGL/Buffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Buffer.cs
@@ -6,6 +6,11 @@ namespace Ryujinx.Graphics.OpenGL
{
static class Buffer
{
+ public static BufferHandle Create()
+ {
+ return Handle.FromInt32<BufferHandle>(GL.GenBuffer());
+ }
+
public static BufferHandle Create(int size)
{
int handle = GL.GenBuffer();
@@ -40,6 +45,12 @@ namespace Ryujinx.Graphics.OpenGL
return data;
}
+ public static void Resize(BufferHandle handle, int size)
+ {
+ GL.BindBuffer(BufferTarget.CopyWriteBuffer, handle.ToInt32());
+ GL.BufferData(BufferTarget.CopyWriteBuffer, size, IntPtr.Zero, BufferUsageHint.StreamCopy);
+ }
+
public static void SetData(BufferHandle buffer, int offset, ReadOnlySpan<byte> data)
{
GL.BindBuffer(BufferTarget.CopyWriteBuffer, buffer.ToInt32());