From f59fae3612eb66dc81a7bd3f74470871413998c3 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Mon, 1 Jul 2024 18:01:53 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20do=20inline=20vertex=20buffer?= =?UTF-8?q?=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Somehow broke zero buff MTLVertexDescriptor, but fixes broken geoemtry so I’m pushing anyway --- src/Ryujinx.Graphics.Metal/EncoderState.cs | 11 +++++------ src/Ryujinx.Graphics.Metal/EncoderStateManager.cs | 15 ++------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderState.cs b/src/Ryujinx.Graphics.Metal/EncoderState.cs index 2f732681b..95f0f21b5 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderState.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderState.cs @@ -22,13 +22,12 @@ namespace Ryujinx.Graphics.Metal StencilRef = 1 << 7, Viewports = 1 << 8, Scissors = 1 << 9, - VertexBuffers = 1 << 10, - Buffers = 1 << 11, - VertexTextures = 1 << 12, - FragmentTextures = 1 << 13, - ComputeTextures = 1 << 14, + Buffers = 1 << 10, + VertexTextures = 1 << 11, + FragmentTextures = 1 << 12, + ComputeTextures = 1 << 13, - RenderAll = RenderPipeline | DepthStencil | DepthClamp | DepthBias | CullMode | FrontFace | StencilRef | Viewports | Scissors | VertexBuffers | Buffers | VertexTextures | FragmentTextures, + RenderAll = RenderPipeline | DepthStencil | DepthClamp | DepthBias | CullMode | FrontFace | StencilRef | Viewports | Scissors | Buffers | VertexTextures | FragmentTextures, ComputeAll = ComputePipeline | Buffers | ComputeTextures, All = RenderAll | ComputeAll, } diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index 7699ed8f6..b76170068 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -179,6 +179,7 @@ namespace Ryujinx.Graphics.Metal { if (_currentState.Dirty.HasFlag(DirtyFlags.RenderPipeline)) { + SetVertexBuffers(renderCommandEncoder, _currentState.VertexBuffers); SetRenderPipelineState(renderCommandEncoder); } @@ -222,11 +223,6 @@ namespace Ryujinx.Graphics.Metal SetScissors(renderCommandEncoder); } - if (_currentState.Dirty.HasFlag(DirtyFlags.VertexBuffers)) - { - SetVertexBuffers(renderCommandEncoder, _currentState.VertexBuffers); - } - if (_currentState.Dirty.HasFlag(DirtyFlags.Buffers)) { SetRenderBuffers(renderCommandEncoder, _currentState.UniformBuffers, _currentState.StorageBuffers); @@ -683,15 +679,8 @@ namespace Ryujinx.Graphics.Metal // Update the buffers on the pipeline UpdatePipelineVertexState(_currentState.VertexBuffers, _currentState.VertexAttribs); - // Inline update - if (_pipeline.Encoders.TryGetRenderEncoder(out MTLRenderCommandEncoder renderCommandEncoder)) - { - SetVertexBuffers(renderCommandEncoder, _currentState.VertexBuffers); - return; - } - // Mark dirty - _currentState.Dirty |= DirtyFlags.RenderPipeline | DirtyFlags.VertexBuffers; + _currentState.Dirty |= DirtyFlags.RenderPipeline; } public void UpdateUniformBuffers(ReadOnlySpan buffers)