aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-08 18:08:00 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit375ee0ba9640c213bba727e85c15493700425557 (patch)
tree2c789bf7d13b8eabfd29634219689ec40322fe9a /Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs
parent23b8a86d35e5b499d75d4f65b6d6a226e7529fd4 (diff)
Fix draw indexed flag not being cleared for instanced draws, also avoid state updates in the middle of a indexed draw
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs30
1 files changed, 18 insertions, 12 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs b/Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs
index b7e8a64b..5c5a1dee 100644
--- a/Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/MethodDraw.cs
@@ -26,29 +26,35 @@ namespace Ryujinx.Graphics.Gpu.Engine
private void DrawEnd(GpuState state, int argument)
{
+ if (_instancedDrawPending)
+ {
+ _drawIndexed = false;
+
+ return;
+ }
+
UpdateState(state);
bool instanced = _vsUsesInstanceId || _isAnyVbInstanced;
if (instanced)
{
- if (!_instancedDrawPending)
- {
- _instancedDrawPending = true;
+ _instancedDrawPending = true;
+
+ _instancedIndexed = _drawIndexed;
- _instancedIndexed = _drawIndexed;
+ _instancedFirstIndex = _firstIndex;
+ _instancedFirstVertex = state.Get<int>(MethodOffset.FirstVertex);
+ _instancedFirstInstance = state.Get<int>(MethodOffset.FirstInstance);
- _instancedFirstIndex = _firstIndex;
- _instancedFirstVertex = state.Get<int>(MethodOffset.FirstVertex);
- _instancedFirstInstance = state.Get<int>(MethodOffset.FirstInstance);
+ _instancedIndexCount = _indexCount;
- _instancedIndexCount = _indexCount;
+ var drawState = state.Get<VertexBufferDrawState>(MethodOffset.VertexBufferDrawState);
- var drawState = state.Get<VertexBufferDrawState>(MethodOffset.VertexBufferDrawState);
+ _instancedDrawStateFirst = drawState.First;
+ _instancedDrawStateCount = drawState.Count;
- _instancedDrawStateFirst = drawState.First;
- _instancedDrawStateCount = drawState.Count;
- }
+ _drawIndexed = false;
return;
}