From 60169fce4c31bb3ac9dd8edee5b9be44c3f41efe Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sat, 19 Nov 2022 17:42:07 +0000 Subject: [PATCH] Support 0-sized constant buffers --- .../main/cpp/skyline/gpu/interconnect/common/pipeline.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/common/pipeline.inc b/app/src/main/cpp/skyline/gpu/interconnect/common/pipeline.inc index ab59225a..40859012 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/common/pipeline.inc +++ b/app/src/main/cpp/skyline/gpu/interconnect/common/pipeline.inc @@ -19,7 +19,7 @@ namespace skyline::gpu::interconnect { static DynamicBufferBinding GetConstantBufferBinding(InterconnectContext &ctx, const Shader::Info &info, BufferView view, size_t idx) { if (!view) // Return a dummy buffer if the constant buffer isn't bound - return BufferBinding{ctx.gpu.megaBufferAllocator.Allocate(ctx.executor.cycle, 0).buffer, 0, PAGE_SIZE}; + return BufferBinding{ctx.gpu.megaBufferAllocator.Allocate(ctx.executor.cycle, PAGE_SIZE).buffer, 0, PAGE_SIZE}; ctx.executor.AttachBuffer(view); @@ -40,6 +40,9 @@ namespace skyline::gpu::interconnect { static constexpr size_t MinAlignment{0x40}; auto ssbo{cbuf.Read(ctx.executor, desc.cbuf_offset)}; + if (ssbo.size == 0) + return BufferBinding{ctx.gpu.megaBufferAllocator.Allocate(ctx.executor.cycle, PAGE_SIZE).buffer, 0, PAGE_SIZE}; + size_t padding{ssbo.address & (MinAlignment - 1)}; cachedView.Update(ctx, ssbo.address - padding, util::AlignUp(ssbo.size + padding, MinAlignment));