mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-02 13:02:44 +01:00
bind uniform buffers
This commit is contained in:
parent
1d39266956
commit
5ace31b471
4 changed files with 8 additions and 6 deletions
|
@ -27,6 +27,7 @@ BufferView::BufferView(MTL::Buffer* buffer_, size_t offset_, size_t size_,
|
||||||
: buffer{buffer_->retain()}, offset{offset_}, size{size_}, format{format_} {}
|
: buffer{buffer_->retain()}, offset{offset_}, size{size_}, format{format_} {}
|
||||||
|
|
||||||
BufferView::~BufferView() {
|
BufferView::~BufferView() {
|
||||||
|
// TODO: uncomment
|
||||||
// buffer->release();
|
// buffer->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ void BufferCacheRuntime::ReserveNullBuffer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MTL::Buffer* BufferCacheRuntime::CreateNullBuffer() {
|
MTL::Buffer* BufferCacheRuntime::CreateNullBuffer() {
|
||||||
return CreatePrivateBuffer(device, NULL_BUFFER_SIZE);
|
return CreatePrivateBuffer(device, NULL_BUFFER_SIZE * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Metal
|
} // namespace Metal
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
[[nodiscard]] BufferView View(u32 offset, u32 size, VideoCore::Surface::PixelFormat format);
|
[[nodiscard]] BufferView View(u32 offset, u32 size, VideoCore::Surface::PixelFormat format);
|
||||||
|
|
||||||
void MarkUsage(u64 offset, u64 size) noexcept {
|
void MarkUsage(u64 offset, u64 size) noexcept {
|
||||||
// TODO: track usage
|
// TODO: track usage?
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] MTL::Buffer* Handle() const noexcept {
|
[[nodiscard]] MTL::Buffer* Handle() const noexcept {
|
||||||
|
@ -122,6 +122,7 @@ public:
|
||||||
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) {}
|
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) {}
|
||||||
|
|
||||||
std::span<u8> BindMappedUniformBuffer(size_t stage, u32 binding_index, u32 size) {
|
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);
|
const StagingBufferRef ref = staging_pool.Request(size, MemoryUsage::Upload);
|
||||||
BindBuffer(stage, binding_index, ref.buffer, static_cast<u32>(ref.offset), size);
|
BindBuffer(stage, binding_index, ref.buffer, static_cast<u32>(ref.offset), size);
|
||||||
|
|
||||||
|
|
|
@ -124,11 +124,11 @@ void RasterizerMetal::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
|
||||||
|
|
||||||
void RasterizerMetal::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
void RasterizerMetal::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
||||||
u32 size) {
|
u32 size) {
|
||||||
LOG_DEBUG(Render_Metal, "called");
|
buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerMetal::DisableGraphicsUniformBuffer(size_t stage, u32 index) {
|
void RasterizerMetal::DisableGraphicsUniformBuffer(size_t stage, u32 index) {
|
||||||
LOG_DEBUG(Render_Metal, "called");
|
buffer_cache.DisableGraphicsUniformBuffer(stage, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerMetal::FlushAll() {
|
void RasterizerMetal::FlushAll() {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -30,7 +29,8 @@ StagingBuffer::StagingBuffer(MTL::Buffer* buffer_, std::span<u8> mapped_span_)
|
||||||
: buffer{buffer_->retain()}, mapped_span{mapped_span_} {}
|
: buffer{buffer_->retain()}, mapped_span{mapped_span_} {}
|
||||||
|
|
||||||
StagingBuffer::~StagingBuffer() {
|
StagingBuffer::~StagingBuffer() {
|
||||||
buffer->release();
|
// TODO: uncomment
|
||||||
|
//buffer->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
StagingBufferRef StagingBuffer::Ref() const noexcept {
|
StagingBufferRef StagingBuffer::Ref() const noexcept {
|
||||||
|
|
Loading…
Reference in a new issue