Fix transform feedback errors caused by host pause/resume and multiple uses (#1634)

* Fix transform feedback errors caused by host pause/resume

* Fix TFB being used as something else issue with copies

* This is supposed to be StreamCopy
This commit is contained in:
gdkchan 2020-10-25 17:23:42 -03:00 committed by GitHub
parent cf0f0fc4e7
commit 812e32f775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 30 deletions

View file

@ -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());