X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fmemoryallocator.cpp;h=6ef5d2bd7a6b8714fb545997819abb11e1995fa9;hp=6ffcc9fc5917bee515e46e7a8ce30da5f80a29a1;hb=a16145549dc87c3b12671f797bd77b14bcc7786b;hpb=bbdf52425b736a59d01dda215458c3a1c9bdb320 diff --git a/source/backends/vulkan/memoryallocator.cpp b/source/backends/vulkan/memoryallocator.cpp index 6ffcc9fc..6ef5d2bd 100644 --- a/source/backends/vulkan/memoryallocator.cpp +++ b/source/backends/vulkan/memoryallocator.cpp @@ -91,6 +91,20 @@ unsigned MemoryAllocator::allocate(VkBuffer buffer, MemoryType type) return id; } +unsigned MemoryAllocator::allocate(VkImage image, MemoryType type) +{ + const VulkanFunctions &vk = device.get_functions(); + + VkMemoryRequirements requirements; + vk.GetImageMemoryRequirements(image, requirements); + + unsigned id = allocate(requirements.size, requirements.memoryTypeBits, type); + + vk.BindImageMemory(image, get_allocation(id).memory, 0); + + return id; +} + void MemoryAllocator::release(unsigned id) { Allocation &alloc = get_allocation(id);