Vulkan Memory Allocator
Functions
Layer 3 Creating Buffers and Images

Functions

VkResult vmaCreateBuffer (VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
 
void vmaDestroyBuffer (VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)
 Destroys Vulkan buffer and frees allocated memory. More...
 
VkResult vmaCreateImage (VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkImage *pImage, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
 Function similar to vmaCreateBuffer(). More...
 
void vmaDestroyImage (VmaAllocator allocator, VkImage image, VmaAllocation allocation)
 Destroys Vulkan image and frees allocated memory. More...
 

Detailed Description

Function Documentation

◆ vmaCreateBuffer()

VkResult vmaCreateBuffer ( VmaAllocator  allocator,
const VkBufferCreateInfo *  pBufferCreateInfo,
const VmaAllocationCreateInfo pAllocationCreateInfo,
VkBuffer *  pBuffer,
VmaAllocation *  pAllocation,
VmaAllocationInfo pAllocationInfo 
)
Parameters
[out]pBufferBuffer that was created.
[out]pAllocationAllocation that was created.
[out]pAllocationInfoOptional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().

This function automatically:

  1. Creates buffer.
  2. Allocates appropriate memory for it.
  3. Binds the buffer with the memory.

If any of these operations fail, buffer and allocation are not created, returned value is negative error code, *pBuffer and *pAllocation are null.

If the function succeeded, you must destroy both buffer and allocation when you no longer need them using either convenience function vmaDestroyBuffer() or separately, using vkDestroyBuffer() and vmaFreeMemory().

◆ vmaCreateImage()

VkResult vmaCreateImage ( VmaAllocator  allocator,
const VkImageCreateInfo *  pImageCreateInfo,
const VmaAllocationCreateInfo pAllocationCreateInfo,
VkImage *  pImage,
VmaAllocation *  pAllocation,
VmaAllocationInfo pAllocationInfo 
)

Function similar to vmaCreateBuffer().

◆ vmaDestroyBuffer()

void vmaDestroyBuffer ( VmaAllocator  allocator,
VkBuffer  buffer,
VmaAllocation  allocation 
)

Destroys Vulkan buffer and frees allocated memory.

This is just a convenience function equivalent to:

vkDestroyBuffer(device, buffer, allocationCallbacks);
vmaFreeMemory(allocator, allocation);

◆ vmaDestroyImage()

void vmaDestroyImage ( VmaAllocator  allocator,
VkImage  image,
VmaAllocation  allocation 
)

Destroys Vulkan image and frees allocated memory.

This is just a convenience function equivalent to:

vkDestroyImage(device, image, allocationCallbacks);
vmaFreeMemory(allocator, allocation);