0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 13:05:46 +00:00

Fix instanced indexed inline draws (#3383)

This commit is contained in:
gdkchan 2022-06-05 21:24:28 -03:00 committed by GitHub
parent dd8f97ab9e
commit 46cc7b55f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private bool _instancedDrawPending; private bool _instancedDrawPending;
private bool _instancedIndexed; private bool _instancedIndexed;
private bool _instancedIndexedInline;
private int _instancedFirstIndex; private int _instancedFirstIndex;
private int _instancedFirstVertex; private int _instancedFirstVertex;
@ -135,6 +136,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_instancedDrawPending = true; _instancedDrawPending = true;
_instancedIndexed = _drawState.DrawIndexed; _instancedIndexed = _drawState.DrawIndexed;
_instancedIndexedInline = _drawState.IbStreamer.HasInlineIndexData;
_instancedFirstIndex = firstIndex; _instancedFirstIndex = firstIndex;
_instancedFirstVertex = (int)_state.State.FirstVertex; _instancedFirstVertex = (int)_state.State.FirstVertex;
@ -451,7 +453,21 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{ {
_instancedDrawPending = false; _instancedDrawPending = false;
if (_instancedIndexed) if (_instancedIndexedInline)
{
int inlineIndexCount = _drawState.IbStreamer.GetAndResetInlineIndexCount();
BufferRange br = new BufferRange(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
_channel.BufferManager.SetIndexBuffer(br, IndexType.UInt);
_context.Renderer.Pipeline.DrawIndexed(
inlineIndexCount,
_instanceIndex + 1,
_instancedFirstIndex,
_instancedFirstVertex,
_instancedFirstInstance);
}
else if (_instancedIndexed)
{ {
_context.Renderer.Pipeline.DrawIndexed( _context.Renderer.Pipeline.DrawIndexed(
_instancedIndexCount, _instancedIndexCount,