]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/memoryallocator.cpp
Remove the unused get_allocation_size function
[libs/gl.git] / source / backends / vulkan / memoryallocator.cpp
index 6ffcc9fc5917bee515e46e7a8ce30da5f80a29a1..4289e28d6a64a20b39d6dc87ba161ad6749ba4bc 100644 (file)
@@ -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);
@@ -102,11 +116,6 @@ void MemoryAllocator::release(unsigned id)
        vk.FreeMemory(alloc.memory);
 }
 
-size_t MemoryAllocator::get_allocation_size(unsigned id) const
-{
-       return get_allocation(id).size;
-}
-
 void *MemoryAllocator::map(unsigned id, size_t offset, size_t size)
 {
        Allocation &alloc = get_allocation(id);