Fix vertex buffer size when switching between inline and state draw parameters (#6101)

* Fix vertex buffer size when switching between inline and state draw parameters

* Format whitespace
This commit is contained in:
gdkchan
2024-01-14 05:37:19 -03:00
committed by GitHub
parent 4e19b36ad7
commit f4b74e9ce1
3 changed files with 19 additions and 11 deletions

View File

@@ -47,7 +47,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private uint _vbEnableMask;
private bool _prevDrawIndexed;
private readonly bool _prevDrawIndirect;
private bool _prevDrawIndirect;
private bool _prevDrawUsesEngineState;
private IndexType _prevIndexType;
private uint _prevFirstVertex;
private bool _prevTfEnable;
@@ -236,7 +237,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
// method when doing indexed draws, so we need to make sure
// to update the vertex buffers if we are doing a regular
// draw after a indexed one and vice-versa.
if (_drawState.DrawIndexed != _prevDrawIndexed)
// Some draws also do not update the engine state, so it is possible for it
// to not be dirty even if the vertex counts or other state changed. We need to force it to be dirty in this case.
if (_drawState.DrawIndexed != _prevDrawIndexed || _drawState.DrawUsesEngineState != _prevDrawUsesEngineState)
{
_updateTracker.ForceDirty(VertexBufferStateIndex);
@@ -251,6 +254,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
_prevDrawIndexed = _drawState.DrawIndexed;
_prevDrawUsesEngineState = _drawState.DrawUsesEngineState;
}
// Some draw parameters are used to restrict the vertex buffer size,
@@ -260,6 +264,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (_drawState.DrawIndirect != _prevDrawIndirect)
{
_updateTracker.ForceDirty(VertexBufferStateIndex);
_prevDrawIndirect = _drawState.DrawIndirect;
}
// In some cases, the index type is also used to guess the