mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 01:55:27 +00:00
5fe0bc584b
* Directly send host address to buffer data * Cleanup OGLShader * Directly copy vertex and index data too * Revert shader bind "cache" * Address feedback
49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using OpenTK.Graphics.OpenGL;
|
|
using System;
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
{
|
|
class OGLStreamBuffer : IDisposable
|
|
{
|
|
public int Handle { get; protected set; }
|
|
|
|
public int Size { get; protected set; }
|
|
|
|
protected BufferTarget Target { get; private set; }
|
|
|
|
public OGLStreamBuffer(BufferTarget Target, int Size)
|
|
{
|
|
this.Target = Target;
|
|
this.Size = Size;
|
|
|
|
Handle = GL.GenBuffer();
|
|
|
|
GL.BindBuffer(Target, Handle);
|
|
|
|
GL.BufferData(Target, Size, IntPtr.Zero, BufferUsageHint.StreamDraw);
|
|
}
|
|
|
|
public void SetData(int Size, IntPtr HostAddress)
|
|
{
|
|
GL.BindBuffer(Target, Handle);
|
|
|
|
GL.BufferSubData(Target, IntPtr.Zero, Size, HostAddress);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Dispose(true);
|
|
}
|
|
|
|
protected virtual void Dispose(bool Disposing)
|
|
{
|
|
if (Disposing && Handle != 0)
|
|
{
|
|
GL.DeleteBuffer(Handle);
|
|
|
|
Handle = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|