aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.OpenGL')
-rw-r--r--Ryujinx.Graphics.OpenGL/Buffer.cs21
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs11
2 files changed, 29 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Buffer.cs b/Ryujinx.Graphics.OpenGL/Buffer.cs
index 89216b83..ecb7dc90 100644
--- a/Ryujinx.Graphics.OpenGL/Buffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Buffer.cs
@@ -6,6 +6,27 @@ namespace Ryujinx.Graphics.OpenGL
{
static class Buffer
{
+ public static void Clear(BufferHandle destination, int offset, int size, uint value)
+ {
+ GL.BindBuffer(BufferTarget.CopyWriteBuffer, destination.ToInt32());
+
+ unsafe
+ {
+ uint* valueArr = stackalloc uint[1];
+
+ valueArr[0] = value;
+
+ GL.ClearBufferSubData(
+ BufferTarget.CopyWriteBuffer,
+ PixelInternalFormat.Rgba8ui,
+ (IntPtr)offset,
+ (IntPtr)size,
+ PixelFormat.RgbaInteger,
+ PixelType.UnsignedByte,
+ (IntPtr)valueArr);
+ }
+ }
+
public static BufferHandle Create()
{
return Handle.FromInt32<BufferHandle>(GL.GenBuffer());
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 8b0a86aa..b6a34e9c 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -91,6 +91,11 @@ namespace Ryujinx.Graphics.OpenGL
_tfEnabled = true;
}
+ public void ClearBuffer(BufferHandle destination, int offset, int size, uint value)
+ {
+ Buffer.Clear(destination, offset, size, value);
+ }
+
public void ClearRenderTargetColor(int index, uint componentMask, ColorF color)
{
GL.ColorMask(
@@ -102,7 +107,7 @@ namespace Ryujinx.Graphics.OpenGL
float[] colors = new float[] { color.Red, color.Green, color.Blue, color.Alpha };
- GL.ClearBuffer(ClearBuffer.Color, index, colors);
+ GL.ClearBuffer(OpenTK.Graphics.OpenGL.ClearBuffer.Color, index, colors);
RestoreComponentMask(index);
@@ -133,11 +138,11 @@ namespace Ryujinx.Graphics.OpenGL
}
else if (depthMask)
{
- GL.ClearBuffer(ClearBuffer.Depth, 0, ref depthValue);
+ GL.ClearBuffer(OpenTK.Graphics.OpenGL.ClearBuffer.Depth, 0, ref depthValue);
}
else if (stencilMask != 0)
{
- GL.ClearBuffer(ClearBuffer.Stencil, 0, ref stencilValue);
+ GL.ClearBuffer(OpenTK.Graphics.OpenGL.ClearBuffer.Stencil, 0, ref stencilValue);
}
if (stencilMaskChanged)