1 #ifndef MSP_GL_VULKAN_MEMORYALLOCATOR_H_
2 #define MSP_GL_VULKAN_MEMORYALLOCATOR_H_
5 #include <msp/graphics/vulkancontext.h>
26 VkDeviceMemory memory = 0;
27 MemoryType type = UNKNOWN_MEMORY;
29 void *mapped_address = 0;
33 VkPhysicalDevice phys_device;
34 std::vector<MemoryType> memory_types;
35 std::vector<Allocation> allocations;
38 MemoryAllocator(Device &);
41 unsigned find_memory_type_index(unsigned, MemoryType);
42 unsigned allocate(std::size_t, unsigned, MemoryType);
43 Allocation &get_allocation(unsigned);
44 const Allocation &get_allocation(unsigned) const;
47 unsigned allocate(VkBuffer, MemoryType);
48 unsigned allocate(VkImage, MemoryType);
49 void release(unsigned);
51 std::size_t get_allocation_size(unsigned) const;
53 void *map(unsigned, std::size_t, std::size_t);