11 #ifndef __VE_MEMORY_H__
12 #define __VE_MEMORY_H__
18 #include <vk_mem_alloc.h>
41 const VmaAllocationInfo &
info()
const {
return myInfo; }
43 bool isValid()
const {
return myAllocation !=
nullptr; }
45 void free(VmaAllocator allocator);
59 void unmap(VmaAllocator allocator);
70 VmaAllocatorCreateFlags
flags);
105 VmaAllocatorCreateFlags flags);
118 VkDeviceMemory
getVkMem()
const {
return allocInfo().deviceMemory; }
141 *
this = std::move(other);
146 std::swap(myAllocation, other.myAllocation);
148 std::swap(myAllocator, other.myAllocator);
157 VmaAllocator allocator,
162 , myAllocator(allocator)
165 myData.flags =
flags;
166 myData.mappedPtr =
nullptr;
209 VmaAllocationCreateFlags
flags);
214 VmaAllocationCreateFlags flags);
221 return myMemoryProperties;
227 void printMemoryInfo()
const;
228 void printMemoryInfo(std::ostream* out =
nullptr)
const;
231 void getMemoryUsage(
exint* out_device_vma_alloc_size,
232 exint* out_device_vk_alloc_size,
233 exint* out_device_total_size,
234 exint* out_shared_vma_alloc_size,
235 exint* out_shared_vk_alloc_size,
236 exint* out_shared_total_size)
const;
257 *
this = std::move(other);
262 std::swap(myAllocator, other.myAllocator);
263 std::swap(myMemoryProperties, other.myMemoryProperties);
264 std::swap(myGLExportPool, other.myGLExportPool);
265 std::swap(myGLSharedExportPool, other.myGLSharedExportPool);
270 void createGLExportPool(VkDevice);
289 VmaAllocatorCreateFlags
flags);
const VmaAllocationInfo & info() const
VkDeviceMemory getVkMem() const
VE_VmaMappableAllocation allocation
VE_MemoryAllocator & operator=(VE_MemoryAllocator &&other) noexcept
VkFlags VkExternalMemoryHandleTypeFlags
void swap(UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &a, UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &b)
const void * mappedPointer() const
VE_Memory & operator=(VE_Memory &&other) noexcept
VkDeviceSize getOffset() const
VE_Memory(VE_Memory &&other) noexcept
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
VE_API VkExternalMemoryHandleTypeFlags VEgetExternalMemoryHandleType()
Returns the platform specific external memory handle type.
const VmaAllocationInfo & allocInfo() const
VE_Result< ImageAllocation > allocateImage(const VkImageCreateInfo &, const VmaAllocationCreateInfo &info)
const VkPhysicalDeviceMemoryProperties & physicalDeviceMemoryProperties() const
VkDeviceSize getSize() const
VE_API VE_Result< VmaAllocator > VEcreateVmaAllocator(VkInstance, VkPhysicalDevice, VkDevice, uint32_t req_ver, VmaAllocatorCreateFlags flags)
VE_Result< VE_VmaAllocation > allocateMemory(const VkMemoryRequirements &, const VmaAllocationCreateInfo &info)
VE_MemoryAllocator(VE_MemoryAllocator &&other) noexcept
VE_MemType getType() const
static VE_Result< VE_VmaMemoryAllocator > create(VkInstance, VkPhysicalDevice, VkDevice, uint32_t req_ver, VmaAllocatorCreateFlags flags)
VE_Result< BufferAllocation > allocateBuffer(const VkBufferCreateInfo &, const VmaAllocationCreateInfo &info)
VE_API void VEdestroyVmaAllocator(VmaAllocator)
VE_VmaAllocation allocation