bind uniform buffers

This commit is contained in:
Samuliak 2024-10-05 18:45:57 +02:00
parent 1d39266956
commit 5ace31b471
No known key found for this signature in database
4 changed files with 8 additions and 6 deletions

View file

@ -27,6 +27,7 @@ BufferView::BufferView(MTL::Buffer* buffer_, size_t offset_, size_t size_,
: buffer{buffer_->retain()}, offset{offset_}, size{size_}, format{format_} {}
BufferView::~BufferView() {
// TODO: uncomment
// buffer->release();
}
@ -121,7 +122,7 @@ void BufferCacheRuntime::ReserveNullBuffer() {
}
MTL::Buffer* BufferCacheRuntime::CreateNullBuffer() {
return CreatePrivateBuffer(device, NULL_BUFFER_SIZE);
return CreatePrivateBuffer(device, NULL_BUFFER_SIZE * 2);
}
} // namespace Metal

View file

@ -36,7 +36,7 @@ public:
[[nodiscard]] BufferView View(u32 offset, u32 size, VideoCore::Surface::PixelFormat format);
void MarkUsage(u64 offset, u64 size) noexcept {
// TODO: track usage
// TODO: track usage?
}
[[nodiscard]] MTL::Buffer* Handle() const noexcept {
@ -122,6 +122,7 @@ public:
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) {}
std::span<u8> BindMappedUniformBuffer(size_t stage, u32 binding_index, u32 size) {
// TODO: just set bytes in case the size is <= 4KB?
const StagingBufferRef ref = staging_pool.Request(size, MemoryUsage::Upload);
BindBuffer(stage, binding_index, ref.buffer, static_cast<u32>(ref.offset), size);

View file

@ -124,11 +124,11 @@ void RasterizerMetal::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
void RasterizerMetal::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
u32 size) {
LOG_DEBUG(Render_Metal, "called");
buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size);
}
void RasterizerMetal::DisableGraphicsUniformBuffer(size_t stage, u32 index) {
LOG_DEBUG(Render_Metal, "called");
buffer_cache.DisableGraphicsUniformBuffer(stage, index);
}
void RasterizerMetal::FlushAll() {

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
@ -30,7 +29,8 @@ StagingBuffer::StagingBuffer(MTL::Buffer* buffer_, std::span<u8> mapped_span_)
: buffer{buffer_->retain()}, mapped_span{mapped_span_} {}
StagingBuffer::~StagingBuffer() {
buffer->release();
// TODO: uncomment
//buffer->release();
}
StagingBufferRef StagingBuffer::Ref() const noexcept {