Vulkan Memory Allocator
Functions
Layer 3 Creating Buffers and Images

Functions

VkResult vmaCreateBuffer (VmaAllocator allocator, const VkBufferCreateInfo *pCreateInfo, const VmaMemoryRequirements *pMemoryRequirements, VkBuffer *pBuffer, VkMappedMemoryRange *pMemory, uint32_t *pMemoryTypeIndex)
 
void vmaDestroyBuffer (VmaAllocator allocator, VkBuffer buffer)
 
VkResult vmaCreateImage (VmaAllocator allocator, const VkImageCreateInfo *pCreateInfo, const VmaMemoryRequirements *pMemoryRequirements, VkImage *pImage, VkMappedMemoryRange *pMemory, uint32_t *pMemoryTypeIndex)
 Function similar to vmaCreateBuffer(). More...
 
void vmaDestroyImage (VmaAllocator allocator, VkImage image)
 

Detailed Description

Function Documentation

◆ vmaCreateBuffer()

VkResult vmaCreateBuffer ( VmaAllocator  allocator,
const VkBufferCreateInfo *  pCreateInfo,
const VmaMemoryRequirements pMemoryRequirements,
VkBuffer *  pBuffer,
VkMappedMemoryRange *  pMemory,
uint32_t *  pMemoryTypeIndex 
)
Parameters
[out]pMemoryOptional. Pass null if you don't need this information.
[out]pMemoryTypeIndexOptional. Pass null if you don't need this information.

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().

All allocated buffers and images are also automatically destroyed in vmaDestroyAllocator(), along with their memory allocations.

◆ vmaCreateImage()

VkResult vmaCreateImage ( VmaAllocator  allocator,
const VkImageCreateInfo *  pCreateInfo,
const VmaMemoryRequirements pMemoryRequirements,
VkImage *  pImage,
VkMappedMemoryRange *  pMemory,
uint32_t *  pMemoryTypeIndex 
)

Function similar to vmaCreateBuffer().

◆ vmaDestroyBuffer()

void vmaDestroyBuffer ( VmaAllocator  allocator,
VkBuffer  buffer 
)

◆ vmaDestroyImage()

void vmaDestroyImage ( VmaAllocator  allocator,
VkImage  image 
)