From 65149cfe9ff3f65611ed76e4a13490536bda05cb Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 28 May 2024 01:45:59 -0400 Subject: [PATCH] Buffer Descriptor Step Functions --- src/Ryujinx.Graphics.Metal/EncoderStateManager.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index b2c490ec90..f440a9a608 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -740,13 +740,26 @@ namespace Ryujinx.Graphics.Metal { var layout = vertexDescriptor.Layouts.Object((ulong)i); layout.Stride = (indexMask & (1u << i)) != 0 ? (ulong)bufferDescriptors[i].Stride : 0; + + if (bufferDescriptors[i].Divisor > 0) + { + layout.StepFunction = MTLVertexStepFunction.PerInstance; + layout.StepRate = (ulong)bufferDescriptors[i].Divisor; + } + else + { + layout.StepFunction = MTLVertexStepFunction.PerVertex; + layout.StepRate = 1; + } } // Zero buffer if ((indexMask & (1u << bufferDescriptors.Length)) != 0) { var layout = vertexDescriptor.Layouts.Object((ulong)bufferDescriptors.Length); - layout.Stride = ZeroBufferSize; + layout.Stride = 1; + layout.StepFunction = MTLVertexStepFunction.Constant; + layout.StepRate = 0; } return vertexDescriptor;