Allow jumbo sized memory allocations

This commit is contained in:
Georg Hagen
2024-10-25 08:56:49 +02:00
parent 81df933dc9
commit 55894a9bd1

View File

@@ -101,6 +101,7 @@ namespace OpenVulkano::Vulkan
MemoryAllocation* MemoryPool::GetFreeMemoryAllocation(size_t size, vk::DeviceSize alignment, uint32_t type, bool createIfAllFull) MemoryAllocation* MemoryPool::GetFreeMemoryAllocation(size_t size, vk::DeviceSize alignment, uint32_t type, bool createIfAllFull)
{ {
constexpr size_t ALLOC_SIZE = 128_MiB;
MemoryAllocation* alloc = nullptr; MemoryAllocation* alloc = nullptr;
for (auto& allocation : allocations) for (auto& allocation : allocations)
{ {
@@ -110,7 +111,7 @@ namespace OpenVulkano::Vulkan
break; break;
} }
} }
if(!alloc && createIfAllFull) alloc = CreateMemoryAllocation(128_MiB, type, true); if(!alloc && createIfAllFull) alloc = CreateMemoryAllocation(std::max(ALLOC_SIZE, size), type, true);
return alloc; return alloc;
} }