11 #ifndef __VE_MEMORY_H__
12 #define __VE_MEMORY_H__
18 #include <vk_mem_alloc.h>
44 const VmaAllocationInfo &
info()
const {
return myInfo; }
46 bool isValid()
const {
return myAllocation !=
nullptr; }
48 void free(VmaAllocator allocator);
62 void unmap(VmaAllocator allocator);
73 VmaAllocatorCreateFlags
flags);
108 VmaAllocatorCreateFlags flags);
121 VkDeviceMemory
getVkMem()
const {
return allocInfo().deviceMemory; }
144 *
this = std::move(other);
149 std::swap(myAllocation, other.myAllocation);
151 std::swap(myAllocator, other.myAllocator);
153 std::swap(myExternalHandle, other.myExternalHandle);
176 VmaAllocator allocator,
181 , myAllocator(allocator)
184 myData.flags =
flags;
185 myData.mappedPtr =
nullptr;
232 VmaAllocationCreateFlags
flags);
237 VmaAllocationCreateFlags flags);
244 return myMemoryProperties;
250 void printMemoryInfo()
const;
251 void printMemoryInfo(std::ostream* out =
nullptr)
const;
254 void getMemoryUsage(
exint* out_device_vma_alloc_size,
255 exint* out_device_vk_alloc_size,
256 exint* out_device_total_size,
257 exint* out_shared_vma_alloc_size,
258 exint* out_shared_vk_alloc_size,
259 exint* out_shared_total_size)
const;
269 exint alignment = 0);
281 *
this = std::move(other);
286 std::swap(myAllocator, other.myAllocator);
287 std::swap(myMemoryProperties, other.myMemoryProperties);
288 std::swap(myGLExportPool, other.myGLExportPool);
289 std::swap(myGLSharedExportPool, other.myGLSharedExportPool);
294 void createGLExportPool(VkDevice);
313 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
GLint GLint GLsizei GLint GLenum GLenum type
#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