diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-11-30 18:06:40 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-30 18:06:40 -0300 |
commit | 8750b90a7f5e76cdff991a137ec8c2eed0db00dd (patch) | |
tree | dc49d19ef44a6017ffc6f6e157a21f9ea5c843c1 /Ryujinx.Graphics.OpenGL/VertexArray.cs | |
parent | af01100050268de7a10889008e98e479f1247af1 (diff) |
Ensure that vertex attribute buffer index is valid on GPU (#3942)1.1.400
* Ensure that vertex attribute buffer index is valid on GPU
* Remove vertex buffer validation code from OpenGL
* Remove some fields that are no longer necessary
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/VertexArray.cs')
-rw-r--r-- | Ryujinx.Graphics.OpenGL/VertexArray.cs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/Ryujinx.Graphics.OpenGL/VertexArray.cs b/Ryujinx.Graphics.OpenGL/VertexArray.cs index d466199d..7d22033e 100644 --- a/Ryujinx.Graphics.OpenGL/VertexArray.cs +++ b/Ryujinx.Graphics.OpenGL/VertexArray.cs @@ -10,13 +10,9 @@ namespace Ryujinx.Graphics.OpenGL { public int Handle { get; private set; } - private bool _needsAttribsUpdate; - private readonly VertexAttribDescriptor[] _vertexAttribs; private readonly VertexBufferDescriptor[] _vertexBuffers; - private int _vertexAttribsCount; - private int _vertexBuffersCount; private int _minVertexCount; private uint _vertexAttribsInUse; @@ -76,9 +72,7 @@ namespace Ryujinx.Graphics.OpenGL _vertexBuffers[bindingIndex] = vb; } - _vertexBuffersCount = bindingIndex; _minVertexCount = minVertexCount; - _needsAttribsUpdate = true; } public void SetVertexAttributes(ReadOnlySpan<VertexAttribDescriptor> vertexAttribs) @@ -131,8 +125,6 @@ namespace Ryujinx.Graphics.OpenGL _vertexAttribs[index] = attrib; } - _vertexAttribsCount = index; - for (; index < Constants.MaxVertexAttribs; index++) { DisableVertexAttrib(index); @@ -160,13 +152,11 @@ namespace Ryujinx.Graphics.OpenGL public void PreDraw(int vertexCount) { LimitVertexBuffers(vertexCount); - Validate(); } public void PreDrawVbUnbounded() { UnlimitVertexBuffers(); - Validate(); } public void LimitVertexBuffers(int vertexCount) @@ -252,36 +242,6 @@ namespace Ryujinx.Graphics.OpenGL _vertexBuffersLimited = 0; } - public void Validate() - { - for (int attribIndex = 0; attribIndex < _vertexAttribsCount; attribIndex++) - { - VertexAttribDescriptor attrib = _vertexAttribs[attribIndex]; - - if (!attrib.IsZero) - { - if ((uint)attrib.BufferIndex >= _vertexBuffersCount) - { - DisableVertexAttrib(attribIndex); - continue; - } - - if (_vertexBuffers[attrib.BufferIndex].Buffer.Handle == BufferHandle.Null) - { - DisableVertexAttrib(attribIndex); - continue; - } - - if (_needsAttribsUpdate) - { - EnableVertexAttrib(attribIndex); - } - } - } - - _needsAttribsUpdate = false; - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] private void EnableVertexAttrib(int index) { |