HDK
|
#include <VE_Memory.h>
Public Member Functions | |
const VkPhysicalDeviceMemoryProperties & | physicalDeviceMemoryProperties () const |
UT_Array< VmaBudget > | heapInfos () const |
void | printMemoryInfo () const |
void | printMemoryInfo (std::ostream *out=nullptr) const |
void | getMemoryUsage (exint *out_device_vma_alloc_size, exint *out_device_vk_alloc_size, exint *out_device_total_size, exint *out_shared_vma_alloc_size, exint *out_shared_vk_alloc_size, exint *out_shared_total_size) const |
VE_Result< VE_Memory > | allocateImage (VE_MemType type, const VkImageCreateInfo &img_info, VkImage &vk_img) |
VE_Result< VE_Memory > | allocateBuffer (VE_MemType type, const VkBufferCreateInfo &buf_info, VkBuffer &vk_buf) |
VE_Result< VE_Memory > | allocateMemory (VE_MemType type, const VkMemoryRequirements &info) |
VE_MemoryAllocator ()=default | |
~VE_MemoryAllocator () | |
UT_NON_COPYABLE (VE_MemoryAllocator) | |
VE_MemoryAllocator (VE_MemoryAllocator &&other) noexcept | |
VE_MemoryAllocator & | operator= (VE_MemoryAllocator &&other) noexcept |
Static Public Member Functions | |
static VE_Result < VE_MemoryAllocator > | create (VkInstance, VkPhysicalDevice, VkDevice, uint32_t req_ver, VmaAllocationCreateFlags flags) |
static VE_Result < VE_MemoryAllocator > | create (const VE_Instance &, VkPhysicalDevice, VkDevice, VmaAllocationCreateFlags flags) |
static VkExternalMemoryHandleTypeFlags | getExternMemHandleType () |
General purpose allocator for vulkan backed memory blocks that tries to balance convenience, safety, and performance.
The main convenience offered is that memory blocks allocated from this object will free themselves when they go out of scope. The caller does not need to explicity free them. This makes this class well suited for allocating lots of resources that would be difficult to keep track of manually.
However, the memory blocks do this by maintaining references to the underlying VmaAllocator object handle, which is owned by and cleaned up by this class. Therefore, care must be taken to ensure this object's life time extends beyond its allocated blocks. If the memory blocks and this allocator are kept as members of a larger structure, ensure proper member ordering so that the blocks are destroyed before the allocator.
Thread safety: This allocator contains no locks and attempts no cross thread synchronization. If you need memory allocations in different threads, you should give those threads their own allocator.
Definition at line 201 of file VE_Memory.h.
|
default |
VE_MemoryAllocator::~VE_MemoryAllocator | ( | ) |
|
inlinenoexcept |
Definition at line 255 of file VE_Memory.h.
VE_Result<VE_Memory> VE_MemoryAllocator::allocateBuffer | ( | VE_MemType | type, |
const VkBufferCreateInfo & | buf_info, | ||
VkBuffer & | vk_buf | ||
) |
VE_Result<VE_Memory> VE_MemoryAllocator::allocateImage | ( | VE_MemType | type, |
const VkImageCreateInfo & | img_info, | ||
VkImage & | vk_img | ||
) |
VE_Result<VE_Memory> VE_MemoryAllocator::allocateMemory | ( | VE_MemType | type, |
const VkMemoryRequirements & | info | ||
) |
|
static |
|
static |
|
static |
void VE_MemoryAllocator::getMemoryUsage | ( | exint * | out_device_vma_alloc_size, |
exint * | out_device_vk_alloc_size, | ||
exint * | out_device_total_size, | ||
exint * | out_shared_vma_alloc_size, | ||
exint * | out_shared_vk_alloc_size, | ||
exint * | out_shared_total_size | ||
) | const |
UT_Array<VmaBudget> VE_MemoryAllocator::heapInfos | ( | ) | const |
|
inlinenoexcept |
Definition at line 260 of file VE_Memory.h.
|
inline |
Definition at line 218 of file VE_Memory.h.
void VE_MemoryAllocator::printMemoryInfo | ( | ) | const |
void VE_MemoryAllocator::printMemoryInfo | ( | std::ostream * | out = nullptr | ) | const |
VE_MemoryAllocator::UT_NON_COPYABLE | ( | VE_MemoryAllocator | ) |