From c24e3c23ff16cf46efdf3f077a5a375d7ed7e3df Mon Sep 17 00:00:00 2001 From: Samuliak Date: Sat, 5 Oct 2024 15:40:10 +0200 Subject: [PATCH] bind vertex buffers --- src/video_core/renderer_metal/mtl_buffer_cache.cpp | 14 +++++++++----- src/video_core/renderer_metal/mtl_buffer_cache.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/video_core/renderer_metal/mtl_buffer_cache.cpp b/src/video_core/renderer_metal/mtl_buffer_cache.cpp index 61e72f2ef2..e7bc6e8672 100644 --- a/src/video_core/renderer_metal/mtl_buffer_cache.cpp +++ b/src/video_core/renderer_metal/mtl_buffer_cache.cpp @@ -93,14 +93,18 @@ void BufferCacheRuntime::BindQuadIndexBuffer(PrimitiveTopology topology, u32 fir // TODO: bind quad index buffer } -void BufferCacheRuntime::BindVertexBuffer(size_t stage, u32 index, MTL::Buffer* buffer, u32 offset, - u32 size, u32 stride) { - // TODO: use stride - BindBuffer(stage, MAX_METAL_BUFFERS - index - 1, buffer, offset, size); +void BufferCacheRuntime::BindVertexBuffer(u32 index, MTL::Buffer* buffer, u32 offset, u32 size, + u32 stride) { + // TODO: use stride? + BindBuffer(0, MAX_METAL_BUFFERS - index - 1, buffer, offset, size); } void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) { - // TODO: implement + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + auto handle = bindings.buffers[index]->Handle(); + // TODO: set stride? + BindVertexBuffer(index, handle, bindings.offsets[index], bindings.sizes[index], 0); + } } void BufferCacheRuntime::BindBuffer(size_t stage, u32 binding_index, MTL::Buffer* buffer, diff --git a/src/video_core/renderer_metal/mtl_buffer_cache.h b/src/video_core/renderer_metal/mtl_buffer_cache.h index 372b368f96..f165813c3c 100644 --- a/src/video_core/renderer_metal/mtl_buffer_cache.h +++ b/src/video_core/renderer_metal/mtl_buffer_cache.h @@ -110,7 +110,7 @@ public: void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count); - void BindVertexBuffer(size_t stage, u32 index, MTL::Buffer* buffer, u32 offset, u32 size, + void BindVertexBuffer(u32 index, MTL::Buffer* buffer, u32 offset, u32 size, u32 stride); void BindVertexBuffers(VideoCommon::HostBindings& bindings);