aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/VertexArray.cs
diff options
context:
space:
mode:
authormpnico <mpnico@gmail.com>2021-08-26 23:50:28 +0200
committerGitHub <noreply@github.com>2021-08-26 23:50:28 +0200
commit8e1adb95cf7f67b976f105f4cac26d3ff2986057 (patch)
treef56ee0f92495fc1bd1e307c3bd51a2d1240d197b /Ryujinx.Graphics.OpenGL/VertexArray.cs
parent5cab8ea4ad2388bd035150e79f241ae5df95ab3b (diff)
Add support for HLE macros and accelerate MultiDrawElementsIndirectCount #2 (#2557)
* Add support for HLE macros and accelerate MultiDrawElementsIndirectCount * Add missing barrier * Fix index buffer count * Add support check for each macro hle before use * Add missing xml doc Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/VertexArray.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/VertexArray.cs22
1 files changed, 20 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.OpenGL/VertexArray.cs b/Ryujinx.Graphics.OpenGL/VertexArray.cs
index f2fcba1f..bdf14481 100644
--- a/Ryujinx.Graphics.OpenGL/VertexArray.cs
+++ b/Ryujinx.Graphics.OpenGL/VertexArray.cs
@@ -20,12 +20,17 @@ namespace Ryujinx.Graphics.OpenGL
private uint _vertexAttribsInUse;
private uint _vertexBuffersInUse;
+ private BufferRange _indexBuffer;
+ private BufferHandle _tempIndexBuffer;
+
public VertexArray()
{
Handle = GL.GenVertexArray();
_vertexAttribs = new VertexAttribDescriptor[Constants.MaxVertexAttribs];
_vertexBuffers = new VertexBufferDescriptor[Constants.MaxVertexBuffers];
+
+ _tempIndexBuffer = Buffer.Create();
}
public void Bind()
@@ -120,9 +125,22 @@ namespace Ryujinx.Graphics.OpenGL
}
}
- public void SetIndexBuffer(BufferHandle buffer)
+ public void SetIndexBuffer(BufferRange range)
+ {
+ _indexBuffer = range;
+ GL.BindBuffer(BufferTarget.ElementArrayBuffer, range.Handle.ToInt32());
+ }
+
+ public void SetRangeOfIndexBuffer()
+ {
+ Buffer.Resize(_tempIndexBuffer, _indexBuffer.Size);
+ Buffer.Copy(_indexBuffer.Handle, _tempIndexBuffer, _indexBuffer.Offset, 0, _indexBuffer.Size);
+ GL.BindBuffer(BufferTarget.ElementArrayBuffer, _tempIndexBuffer.ToInt32());
+ }
+
+ public void RestoreIndexBuffer()
{
- GL.BindBuffer(BufferTarget.ElementArrayBuffer, buffer.ToInt32());
+ GL.BindBuffer(BufferTarget.ElementArrayBuffer, _indexBuffer.Handle.ToInt32());
}
public void Validate()