free the allocated memory
authorEleni Maria Stea <estea@igalia.com>
Sun, 11 Mar 2018 19:34:54 +0000 (21:34 +0200)
committerEleni Maria Stea <estea@igalia.com>
Sun, 11 Mar 2018 19:34:54 +0000 (21:34 +0200)
src/vulkan/allocator.cc
src/vulkan/allocator.h
src/vulkan/mesh-vk.cc
src/vulkan/vkutil.cc

index 9d71e9b..714b7cc 100644 (file)
@@ -25,3 +25,8 @@ bool vku_allocate(int size, DevMemBlock *block)
 
        return true;
 }
+
+void vku_free(VkDeviceMemory gpu_memory)
+{
+       vkFreeMemory(vk_device, gpu_memory, 0);
+}
index ad4c87f..83ccee9 100644 (file)
@@ -12,4 +12,7 @@ struct DevMemBlock {
 bool vku_allocate(int size, DevMemBlock *block);
 void vku_free(VkDeviceMemory gpu_memory);
 
+bool vku_map_memory(VkDeviceMemory gpu_mem, int size, void *data);
+void vku_unmap_memory(VkDeviceMemory gpu_mem);
+
 #endif // ALLOCATOR_H_
index b495ea2..97ce2f0 100644 (file)
@@ -88,7 +88,6 @@ bool MeshVK::update_vertex_data()
        //TODO this is going to change when we allocate one mem block for all data,
        //for the moment we map each buffer memory block and we set the data
 
-
        return true;
 }
 
index a64f86f..35a85dd 100644 (file)
@@ -460,6 +460,9 @@ struct vku_buffer *vku_create_buffer(int sz, unsigned int usage)
 void vku_destroy_buffer(struct vku_buffer *buf)
 {
        if(buf) {
+               //TODO change when the allocator changes
+               vku_free(buf->mem_pool);
+
                vkDestroyBuffer(vk_device, buf->buf, 0);
                delete buf;
        }