From 601d67e369c33000c36532349eee9b27f65bc6de Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Tue, 10 May 2022 18:48:20 +0100 Subject: [PATCH] Use resource size rather than allocation size for staging buffer size As per VMA docs: 'Allocation size returned in this variable may be greater than the size requested for the resource e.g. as VkBufferCreateInfo::size. Whole size of the allocation is accessible for operations on memory e.g. using a pointer after mapping with vmaMapMemory(), but operations on the resource e.g. using vkCmdCopyBuffer must be limited to the size of the resource.' --- app/src/main/cpp/skyline/gpu/memory_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/memory_manager.cpp b/app/src/main/cpp/skyline/gpu/memory_manager.cpp index 3030d52c..e4bff55c 100644 --- a/app/src/main/cpp/skyline/gpu/memory_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/memory_manager.cpp @@ -92,7 +92,7 @@ namespace skyline::gpu::memory { VmaAllocationInfo allocationInfo; ThrowOnFail(vmaCreateBuffer(vmaAllocator, &static_cast(bufferCreateInfo), &allocationCreateInfo, &buffer, &allocation, &allocationInfo)); - return std::make_shared(reinterpret_cast(allocationInfo.pMappedData), allocationInfo.size, vmaAllocator, buffer, allocation); + return std::make_shared(reinterpret_cast(allocationInfo.pMappedData), size, vmaAllocator, buffer, allocation); } Buffer MemoryManager::AllocateBuffer(vk::DeviceSize size) {