Vulkan Memory Allocator
Functions
Layer 3 Creating Buffers and Images

Functions

VkResult vmaCreateBuffer (VmaAllocator allocator, const VkBufferCreateInfo *pCreateInfo, const VmaMemoryRequirements *pMemoryRequirements, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
 
void vmaDestroyBuffer (VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)
 
VkResult vmaCreateImage (VmaAllocator allocator, const VkImageCreateInfo *pCreateInfo, const VmaMemoryRequirements *pMemoryRequirements, 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 *  pCreateInfo,
const VmaMemoryRequirements pMemoryRequirements,
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/image.
  2. Allocates appropriate memory for it.
  3. Binds the buffer/image with the memory.

You do not (and should not) pass returned pMemory to vmaFreeMemory. Only calling vmaDestroyBuffer() / vmaDestroyImage() is required for objects created using vmaCreateBuffer() / vmaCreateImage().

◆ vmaCreateImage()

VkResult vmaCreateImage ( VmaAllocator  allocator,
const VkImageCreateInfo *  pCreateInfo,
const VmaMemoryRequirements pMemoryRequirements,
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 
)