mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-20 08:22:02 +00:00
Set Vertex Descriptor properly
This commit is contained in:
parent
5c9d1bd0da
commit
db9de66437
2 changed files with 15 additions and 6 deletions
|
@ -526,12 +526,12 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
public void SetVertexAttribs(ReadOnlySpan<VertexAttribDescriptor> vertexAttribs)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
|
||||
_renderEncoderState.UpdateVertexAttributes(vertexAttribs);
|
||||
}
|
||||
|
||||
public void SetVertexBuffers(ReadOnlySpan<VertexBufferDescriptor> vertexBuffers)
|
||||
{
|
||||
_renderEncoderState.UpdateVertexDescriptor(vertexBuffers);
|
||||
_renderEncoderState.UpdateVertexBuffers(vertexBuffers);
|
||||
}
|
||||
|
||||
public unsafe void SetViewports(ReadOnlySpan<Viewport> viewports)
|
||||
|
|
|
@ -103,17 +103,26 @@ namespace Ryujinx.Graphics.Metal
|
|||
});
|
||||
}
|
||||
|
||||
public void UpdateVertexDescriptor(ReadOnlySpan<VertexBufferDescriptor> vertexBuffers)
|
||||
public void UpdateVertexAttributes(ReadOnlySpan<VertexAttribDescriptor> 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<VertexBufferDescriptor> 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue