Revert "Calculate vertex buffer sizes from index buffer (#1663)" (#2544)

This reverts commit 10d649e6d3.
This commit is contained in:
gdkchan 2021-08-11 22:13:48 -03:00 committed by GitHub
parent 0ba4ade8f1
commit 8196086f7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 352 deletions

View file

@ -34,8 +34,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private byte _vsClipDistancesWritten;
private bool _prevDrawIndexed;
private int _prevFirstIndex;
private int _prevIndexCount;
private bool _prevTfEnable;
/// <summary>
@ -184,25 +182,10 @@ 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 (GraphicsConfig.EnableIndexedVbSizeDetection)
if (_drawState.DrawIndexed != _prevDrawIndexed)
{
if (_drawState.DrawIndexed != _prevDrawIndexed ||
_drawState.FirstIndex != _prevFirstIndex ||
_drawState.IndexCount != _prevIndexCount)
{
_updateTracker.ForceDirty(VertexBufferStateIndex);
_prevDrawIndexed = _drawState.DrawIndexed;
_prevFirstIndex = _drawState.FirstIndex;
_prevIndexCount = _drawState.IndexCount;
}
}
else
{
if (_drawState.DrawIndexed != _prevDrawIndexed)
{
_updateTracker.ForceDirty(VertexBufferStateIndex);
_prevDrawIndexed = _drawState.DrawIndexed;
}
_updateTracker.ForceDirty(VertexBufferStateIndex);
_prevDrawIndexed = _drawState.DrawIndexed;
}
bool tfEnable = _state.State.TfEnable;
@ -804,25 +787,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
// This size may be (much) larger than the real vertex buffer size.
// Avoid calculating it this way, unless we don't have any other option.
ulong vbSizeMax = endAddress.Pack() - address + 1;
int firstIndex = _drawState.FirstIndex;
int indexCount = _drawState.IndexCount;
bool ibCountingProfitable = GraphicsConfig.EnableIndexedVbSizeDetection && IbUtils.IsIbCountingProfitable(vbSizeMax, indexCount);
if (ibCountingProfitable && !_drawState.IbStreamer.HasInlineIndexData && _drawState.DrawIndexed && stride != 0)
{
IndexType ibType = _state.State.IndexBufferState.Type;
ulong ibGpuVa = _state.State.IndexBufferState.Address.Pack();
ulong vertexCount = IbUtils.GetVertexCount(_channel.MemoryManager, ibType, ibGpuVa, firstIndex, indexCount);
size = Math.Min(vertexCount * (ulong)stride, vbSizeMax);
}
else
{
size = vbSizeMax;
}
size = endAddress.Pack() - address + 1;
}
else
{