Vulkan Memory Allocator
Layer 3 Creating Buffers and Images


VkResult vmaCreateBuffer (VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
void vmaDestroyBuffer (VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)
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)

Detailed Description

Function Documentation

◆ vmaCreateBuffer()

VkResult vmaCreateBuffer ( VmaAllocator  allocator,
const VkBufferCreateInfo *  pBufferCreateInfo,
const VmaAllocationCreateInfo pAllocationCreateInfo,
VkBuffer *  pBuffer,
VmaAllocation *  pAllocation,
VmaAllocationInfo pAllocationInfo 
[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 

◆ vmaDestroyImage()

void vmaDestroyImage ( VmaAllocator  allocator,
VkImage  image,
VmaAllocation  allocation