mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-23 19:32:03 +00:00
1f554c1093
* Renaming part 1 * Renaming part 2 * Renaming part 3 * Renaming part 4 * Renaming part 5 * Renaming part 6 * Renaming part 7 * Renaming part 8 * Renaming part 9 * Renaming part 10 * General cleanup * Thought I got all of these * Apply #595 * Additional renaming * Tweaks from feedback * Rename files
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using OpenTK.Graphics.OpenGL;
|
|
using System;
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
{
|
|
class OglStreamBuffer : IDisposable
|
|
{
|
|
public int Handle { get; protected set; }
|
|
|
|
public long Size { get; protected set; }
|
|
|
|
protected BufferTarget Target { get; private set; }
|
|
|
|
public OglStreamBuffer(BufferTarget target, long size)
|
|
{
|
|
Target = target;
|
|
Size = size;
|
|
|
|
Handle = GL.GenBuffer();
|
|
|
|
GL.BindBuffer(target, Handle);
|
|
|
|
GL.BufferData(target, (IntPtr)size, IntPtr.Zero, BufferUsageHint.StreamDraw);
|
|
}
|
|
|
|
public void SetData(long size, IntPtr hostAddress)
|
|
{
|
|
GL.BindBuffer(Target, Handle);
|
|
|
|
GL.BufferSubData(Target, IntPtr.Zero, (IntPtr)size, hostAddress);
|
|
}
|
|
|
|
public void SetData(byte[] data)
|
|
{
|
|
GL.BindBuffer(Target, Handle);
|
|
|
|
GL.BufferSubData(Target, IntPtr.Zero, (IntPtr)data.Length, data);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Dispose(true);
|
|
}
|
|
|
|
protected virtual void Dispose(bool disposing)
|
|
{
|
|
if (disposing && Handle != 0)
|
|
{
|
|
GL.DeleteBuffer(Handle);
|
|
|
|
Handle = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|