mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-11-24 18:20:12 +01:00
Set Vertex Descriptor properly
This commit is contained in:
parent
5c9d1bd0da
commit
db9de66437
@ -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 New Issue
Block a user