From e8f1ca84277240c4d6215eb9cd85713aab73e2f7 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 11 Aug 2022 20:21:56 -0300 Subject: OpenGL: Limit vertex buffer range for non-indexed draws (#3542) * Limit vertex buffer range for non-indexed draws * Fix typo --- Ryujinx.Graphics.OpenGL/Pipeline.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'Ryujinx.Graphics.OpenGL/Pipeline.cs') diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs index fc28c86e..d7cd6fbd 100644 --- a/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -236,7 +236,7 @@ namespace Ryujinx.Graphics.OpenGL return; } - PreDraw(); + PreDraw(vertexCount); if (_primitiveType == PrimitiveType.Quads && !HwCapabilities.SupportsQuads) { @@ -354,7 +354,7 @@ namespace Ryujinx.Graphics.OpenGL return; } - PreDraw(); + PreDrawVbUnbounded(); int indexElemSize = 1; @@ -686,7 +686,7 @@ namespace Ryujinx.Graphics.OpenGL return; } - PreDraw(); + PreDrawVbUnbounded(); GL.BindBuffer((BufferTarget)All.DrawIndirectBuffer, indirectBuffer.Handle.ToInt32()); GL.BindBuffer((BufferTarget)All.ParameterBuffer, parameterBuffer.Handle.ToInt32()); @@ -709,7 +709,7 @@ namespace Ryujinx.Graphics.OpenGL return; } - PreDraw(); + PreDrawVbUnbounded(); _vertexArray.SetRangeOfIndexBuffer(); @@ -1515,11 +1515,22 @@ namespace Ryujinx.Graphics.OpenGL _supportBuffer.Commit(); } + private void PreDraw(int vertexCount) + { + _vertexArray.PreDraw(vertexCount); + PreDraw(); + } + + private void PreDrawVbUnbounded() + { + _vertexArray.PreDrawVbUnbounded(); + PreDraw(); + } + private void PreDraw() { DrawCount++; - _vertexArray.Validate(); _unit0Texture?.Bind(0); _supportBuffer.Commit(); } -- cgit v1.2.3