diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index 93f463418..ad94c9aee 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -526,12 +526,12 @@ namespace Ryujinx.Graphics.Metal public void SetVertexAttribs(ReadOnlySpan vertexAttribs) { - Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!"); + _renderEncoderState.UpdateVertexAttributes(vertexAttribs); } public void SetVertexBuffers(ReadOnlySpan vertexBuffers) { - _renderEncoderState.UpdateVertexDescriptor(vertexBuffers); + _renderEncoderState.UpdateVertexBuffers(vertexBuffers); } public unsafe void SetViewports(ReadOnlySpan viewports) diff --git a/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs b/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs index c394ba385..74254c66f 100644 --- a/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs +++ b/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs @@ -103,17 +103,26 @@ namespace Ryujinx.Graphics.Metal }); } - public void UpdateVertexDescriptor(ReadOnlySpan vertexBuffers) + public void UpdateVertexAttributes(ReadOnlySpan vertexAttribs) { + // Reset Vertex Descriptor _vertexDescriptor = new(); + for (int i = 0; i < vertexAttribs.Length; i++) + { + // TODO: Format should not be hardcoded + _vertexDescriptor.Attributes.Object((ulong)i).Format = MTLVertexFormat.Float4; + _vertexDescriptor.Attributes.Object((ulong)i).BufferIndex = (ulong)vertexAttribs[i].BufferIndex; + _vertexDescriptor.Attributes.Object((ulong)i).Offset = (ulong)vertexAttribs[i].Offset; + } + } + + public void UpdateVertexBuffers(ReadOnlySpan vertexBuffers) + { for (int i = 0; i < vertexBuffers.Length; i++) { if (vertexBuffers[i].Stride != 0) { - // TODO: Format should not be hardcoded - _vertexDescriptor.Attributes.Object((ulong)i).Format = MTLVertexFormat.Float4; - _vertexDescriptor.Attributes.Object((ulong)i).BufferIndex = (ulong)i; _vertexDescriptor.Layouts.Object((ulong)i).Stride = (ulong)vertexBuffers[i].Stride; } }