From 9f0a468f5571f9d5b07396666c82cd1daa568ae5 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 2 Jul 2024 13:41:41 +0100 Subject: [PATCH] Fix zero buff not being reset --- src/Ryujinx.Graphics.Metal/EncoderStateManager.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index 343fcd441..1c37bb3de 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -868,6 +868,7 @@ namespace Ryujinx.Graphics.Metal { ref PipelineState pipeline = ref _currentState.Pipeline; uint indexMask = 0; + int descriptorCount = 0; for (int i = 0; i < attribDescriptors.Length; i++) { @@ -923,13 +924,18 @@ namespace Ryujinx.Graphics.Metal } } + ref var zeroBufLayout = ref pipeline.Internal.VertexBindings[(int)Constants.ZeroBufferIndex]; + // Zero buffer if ((indexMask & (1u << (int)Constants.ZeroBufferIndex)) != 0) { - ref var layout = ref pipeline.Internal.VertexBindings[(int)Constants.ZeroBufferIndex]; - layout.Stride = 1; - layout.StepFunction = MTLVertexStepFunction.Constant; - layout.StepRate = 0; + zeroBufLayout.Stride = 1; + zeroBufLayout.StepFunction = MTLVertexStepFunction.Constant; + zeroBufLayout.StepRate = 0; + } + else + { + zeroBufLayout = new(); } pipeline.VertexAttributeDescriptionsCount = (uint)attribDescriptors.Length;