Vulkan Memory Allocator
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
Buffer suballocation

API elements related to the mechanism of Buffer suballocation - allocating parts of larger buffers that allocator can create implicitly. More...

Classes

struct  VmaBufferAllocatorCreateInfo
 Parameters of created VmaBufferAllocator object to be passed to vmaCreateBufferAllocator(). More...
 
struct  VmaBufferSuballocationCreateInfo
 Parameters of created VmaBufferSuballocation object to be passed to vmaBufferAllocatorAllocate(). More...
 
struct  VmaBufferSuballocationInfo
 Parameters of an existing buffer suballocation, returned by vmaBufferAllocatorAllocate() or vmaGetBufferSuballocationInfo(). More...
 
struct  VmaBufferSuballocation
 Represents a single sub-allocation - allocated part of a larger Vulkan buffer. More...
 
struct  VmaBufferAllocator
 Represent main object that can allocate parts of larger Vulkan buffers. More...
 

Typedefs

typedef enum VmaBufferAllocatorCreateFlagBits VmaBufferAllocatorCreateFlagBits
 Flags to be passed as VmaBufferAllocatorCreateInfo::flags. More...
 
typedef VkFlags VmaBufferAllocatorCreateFlags
 Flags to be passed as VmaBufferAllocatorCreateInfo::flags. See VmaBufferAllocatorCreateFlagBits. More...
 
typedef enum VmaBufferSuballocationCreateFlagBits VmaBufferSuballocationCreateFlagBits
 Flags to be passed as VmaVirtualAllocationCreateInfo::flags. More...
 
typedef VkFlags VmaBufferSuballocationCreateFlags
 Flags to be passed as VmaBufferSuballocationCreateInfo::flags. See VmaBufferSuballocationCreateFlagBits. More...
 
typedef struct VmaBufferAllocatorCreateInfo VmaBufferAllocatorCreateInfo
 Parameters of created VmaBufferAllocator object to be passed to vmaCreateBufferAllocator(). More...
 
typedef struct VmaBufferSuballocationCreateInfo VmaBufferSuballocationCreateInfo
 Parameters of created VmaBufferSuballocation object to be passed to vmaBufferAllocatorAllocate(). More...
 
typedef struct VmaBufferSuballocationInfo VmaBufferSuballocationInfo
 Parameters of an existing buffer suballocation, returned by vmaBufferAllocatorAllocate() or vmaGetBufferSuballocationInfo(). More...
 

Enumerations

enum  VmaBufferAllocatorCreateFlagBits { VMA_BUFFER_ALLOCATOR_CREATE_LINEAR_ALGORITHM_BIT = 0x00000001 , VMA_BUFFER_ALLOCATOR_CREATE_ALGORITHM_MASK , VMA_BUFFER_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF }
 Flags to be passed as VmaBufferAllocatorCreateInfo::flags. More...
 
enum  VmaBufferSuballocationCreateFlagBits {
  VMA_BUFFER_SUBALLOCATION_CREATE_DEDICATED_BUFFER_BIT = 0x00000001 , VMA_BUFFER_SUBALLOCATION_CREATE_NEVER_CREATE_BUFFER_BIT = 0x00000002 , VMA_BUFFER_SUBALLOCATION_CREATE_NEVER_ALLOCATE_BIT = 0x00000004 , VMA_BUFFER_SUBALLOCATION_CREATE_WITHIN_BUDGET_BIT = 0x00000008 ,
  VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = 0x00010000 , VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = 0x00020000 , VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT = 0x00040000 , VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MASK ,
  VMA_BUFFER_SUBALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
}
 Flags to be passed as VmaVirtualAllocationCreateInfo::flags. More...
 

Functions

VkResult vmaCreateBufferAllocator (VmaAllocator allocator, const VmaBufferAllocatorCreateInfo *pCreateInfo, VmaBufferAllocator *pBufferAllocator)
 TODO implement! TODO document! More...
 
void vmaDestroyBufferAllocator (VmaAllocator allocator, VmaBufferAllocator bufferAllocator)
 TODO implement! TODO document! More...
 
VkResult vmaBufferAllocatorAllocate (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, const VmaBufferSuballocationCreateInfo *pCreateInfo, VmaBufferSuballocation *pBufferSuballocation, VmaBufferSuballocationInfo *pBufferSuballocationInfo)
 TODO implement! TODO document! More...
 
void vmaBufferAllocatorFree (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation)
 TODO implement! TODO document! More...
 
void vmaGetBufferSuballocationInfo (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation, VmaBufferSuballocationInfo *pBufferSuballocationInfo)
 TODO implement! TODO document! More...
 
void vmaSetBufferSuballocationUserData (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation, void *pUserData)
 TODO implement! TODO document! More...
 
VkResult vmaMapBufferSuballocation (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation, void **ppData)
 TODO implement! TODO document! More...
 
void vmaUnmapBufferSuballocation (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation)
 TODO implement! TODO document! More...
 
VkResult vmaFlushBufferSuballocation (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation, VkDeviceSize suballocationLocalOffset, VkDeviceSize size)
 TODO implement! TODO document! More...
 
VkResult vmaInvalidateBufferSuballocation (VmaAllocator allocator, VmaBufferAllocator bufferAllocator, VmaBufferSuballocation bufferSuballocation, VkDeviceSize suballocationLocalOffset, VkDeviceSize size)
 TODO implement! TODO document! More...
 

Detailed Description

API elements related to the mechanism of Buffer suballocation - allocating parts of larger buffers that allocator can create implicitly.

Typedef Documentation

◆ VmaBufferAllocatorCreateFlagBits

Flags to be passed as VmaBufferAllocatorCreateInfo::flags.

◆ VmaBufferAllocatorCreateFlags

◆ VmaBufferAllocatorCreateInfo

Parameters of created VmaBufferAllocator object to be passed to vmaCreateBufferAllocator().

◆ VmaBufferSuballocationCreateFlagBits

Flags to be passed as VmaVirtualAllocationCreateInfo::flags.

◆ VmaBufferSuballocationCreateFlags

◆ VmaBufferSuballocationCreateInfo

Parameters of created VmaBufferSuballocation object to be passed to vmaBufferAllocatorAllocate().

◆ VmaBufferSuballocationInfo

Parameters of an existing buffer suballocation, returned by vmaBufferAllocatorAllocate() or vmaGetBufferSuballocationInfo().

Enumeration Type Documentation

◆ VmaBufferAllocatorCreateFlagBits

Flags to be passed as VmaBufferAllocatorCreateInfo::flags.

Enumerator
VMA_BUFFER_ALLOCATOR_CREATE_LINEAR_ALGORITHM_BIT 

Enables alternative, linear allocation algorithm in this virtual block.

Specify this flag to enable linear allocation algorithm, which always creates new allocations after last one and doesn't reuse space from allocations freed in between. It trades memory consumption for simplified algorithm and data structure, which has better performance and uses less memory for metadata.

By using this flag, you can achieve behavior of free-at-once, stack, ring buffer, and double stack. For details, see documentation chapter Linear allocation algorithm.

Internally it uses a Virtual allocator with flag VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT.

VMA_BUFFER_ALLOCATOR_CREATE_ALGORITHM_MASK 

Bit mask to extract only ALGORITHM bits from entire set of flags.

VMA_BUFFER_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM 

◆ VmaBufferSuballocationCreateFlagBits

Flags to be passed as VmaVirtualAllocationCreateInfo::flags.

Enumerator
VMA_BUFFER_SUBALLOCATION_CREATE_DEDICATED_BUFFER_BIT 

Always creates a separate VkBuffer dedicated for this suballocation. Suballocation will then always have buffer-local offset 0.

VMA_BUFFER_SUBALLOCATION_CREATE_NEVER_CREATE_BUFFER_BIT 

Never creates a new VkBuffer or allocates new Vulkan memory. Tries to create the suballocation in a free space of an existing buffer. If not possible, returns VK_ERROR_OUT_OF_DEVICE_MEMORY.

VMA_BUFFER_SUBALLOCATION_CREATE_NEVER_ALLOCATE_BIT 

Never allocates new Vulkan memory. Tries to create the suballocation in a free space of an existing buffer. If not possible, tries to create a new buffer but in existing memory blocks, internally using VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT. If not possible, returns VK_ERROR_OUT_OF_DEVICE_MEMORY.

VMA_BUFFER_SUBALLOCATION_CREATE_WITHIN_BUDGET_BIT 

Creates suballocation only if additional Vulkan memory required for it, if any, won't exceed memory budget. Otherwise return VK_ERROR_OUT_OF_DEVICE_MEMORY.

VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT 

Allocation strategy that chooses smallest possible empty space for the suballocation to minimize memory usage and fragmentation, possibly at the expense of allocation time.

VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT 

Allocation strategy that chooses first suitable empty space for the suballocation - not necessarily in terms of the smallest offset but the one that is easiest and fastest to find to minimize allocation time, possibly at the expense of allocation quality.

VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT 

Allocation strategy that chooses always the lowest offset in available space. This is not the most efficient strategy but achieves highly packed data. Not recommended or useful, provided just for completeness.

VMA_BUFFER_SUBALLOCATION_CREATE_STRATEGY_MASK 

A bit mask to extract only STRATEGY bits from entire set of flags.

VMA_BUFFER_SUBALLOCATION_CREATE_FLAG_BITS_MAX_ENUM 

Function Documentation

◆ vmaBufferAllocatorAllocate()

VkResult vmaBufferAllocatorAllocate ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
const VmaBufferSuballocationCreateInfo pCreateInfo,
VmaBufferSuballocation pBufferSuballocation,
VmaBufferSuballocationInfo pBufferSuballocationInfo 
)

TODO implement! TODO document!

◆ vmaBufferAllocatorFree()

void vmaBufferAllocatorFree ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation 
)

TODO implement! TODO document!

◆ vmaCreateBufferAllocator()

VkResult vmaCreateBufferAllocator ( VmaAllocator  allocator,
const VmaBufferAllocatorCreateInfo pCreateInfo,
VmaBufferAllocator pBufferAllocator 
)

TODO implement! TODO document!

◆ vmaDestroyBufferAllocator()

void vmaDestroyBufferAllocator ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator 
)

TODO implement! TODO document!

◆ vmaFlushBufferSuballocation()

VkResult vmaFlushBufferSuballocation ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation,
VkDeviceSize  suballocationLocalOffset,
VkDeviceSize  size 
)

TODO implement! TODO document!

◆ vmaGetBufferSuballocationInfo()

void vmaGetBufferSuballocationInfo ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation,
VmaBufferSuballocationInfo pBufferSuballocationInfo 
)

TODO implement! TODO document!

◆ vmaInvalidateBufferSuballocation()

VkResult vmaInvalidateBufferSuballocation ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation,
VkDeviceSize  suballocationLocalOffset,
VkDeviceSize  size 
)

TODO implement! TODO document!

◆ vmaMapBufferSuballocation()

VkResult vmaMapBufferSuballocation ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation,
void **  ppData 
)

TODO implement! TODO document!

◆ vmaSetBufferSuballocationUserData()

void vmaSetBufferSuballocationUserData ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation,
void *  pUserData 
)

TODO implement! TODO document!

◆ vmaUnmapBufferSuballocation()

void vmaUnmapBufferSuballocation ( VmaAllocator  allocator,
VmaBufferAllocator  bufferAllocator,
VmaBufferSuballocation  bufferSuballocation 
)

TODO implement! TODO document!