aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-06-05 21:24:28 -0300
committerGitHub <noreply@github.com>2022-06-05 21:24:28 -0300
commit46cc7b55f02fc9e9cbe0637d710b5e5a6c76eaef (patch)
tree85ca152d4bc36283061df9ad65c2f93f4987dbf1
parentdd8f97ab9e77dde25c323feaff97cfc8f19207fa (diff)
Fix instanced indexed inline draws (#3383)1.1.142
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
index 44d2d393..7e35fd2d 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
@@ -18,6 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private bool _instancedDrawPending;
private bool _instancedIndexed;
+ private bool _instancedIndexedInline;
private int _instancedFirstIndex;
private int _instancedFirstVertex;
@@ -135,6 +136,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_instancedDrawPending = true;
_instancedIndexed = _drawState.DrawIndexed;
+ _instancedIndexedInline = _drawState.IbStreamer.HasInlineIndexData;
_instancedFirstIndex = firstIndex;
_instancedFirstVertex = (int)_state.State.FirstVertex;
@@ -451,7 +453,21 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
_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(
_instancedIndexCount,