Vulkan Memory Allocator
Public Attributes | List of all members
VmaAllocatorCreateInfo Struct Reference

Description of a Allocator to be created. More...

#include <vk_mem_alloc.h>

Public Attributes

VmaAllocatorCreateFlags flags
 Flags for created allocator. Use VmaAllocatorCreateFlagBits enum. More...
 
VkPhysicalDevice physicalDevice
 Vulkan physical device. More...
 
VkDevice device
 Vulkan device. More...
 
VkDeviceSize preferredLargeHeapBlockSize
 Preferred size of a single VkDeviceMemory block to be allocated from large heaps > 1 GiB. Optional. More...
 
const VkAllocationCallbacks * pAllocationCallbacks
 Custom CPU memory allocation callbacks. Optional. More...
 
const VmaDeviceMemoryCallbackspDeviceMemoryCallbacks
 Informative callbacks for vkAllocateMemory, vkFreeMemory. Optional. More...
 
uint32_t frameInUseCount
 Maximum number of additional frames that are in use at the same time as current frame. More...
 
const VkDeviceSize * pHeapSizeLimit
 Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap. More...
 
const VmaVulkanFunctionspVulkanFunctions
 Pointers to Vulkan functions. Can be null if you leave define VMA_STATIC_VULKAN_FUNCTIONS 1. More...
 
const VmaRecordSettingspRecordSettings
 Parameters for recording of VMA calls. Can be null. More...
 
VkInstance instance
 Optional handle to Vulkan instance object. More...
 
uint32_t vulkanApiVersion
 Optional. The highest version of Vulkan that the application is designed to use. More...
 

Detailed Description

Description of a Allocator to be created.

Member Data Documentation

◆ device

VkDevice VmaAllocatorCreateInfo::device

Vulkan device.

It must be valid throughout whole lifetime of created allocator.

◆ flags

VmaAllocatorCreateFlags VmaAllocatorCreateInfo::flags

Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.

◆ frameInUseCount

uint32_t VmaAllocatorCreateInfo::frameInUseCount

Maximum number of additional frames that are in use at the same time as current frame.

This value is used only when you make allocations with VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.

For example, if you double-buffer your command buffers, so resources used for rendering in previous frame may still be in use by the GPU at the moment you allocate resources needed for the current frame, set this value to 1.

If you want to allow any allocations other than used in the current frame to become lost, set this value to 0.

◆ instance

VkInstance VmaAllocatorCreateInfo::instance

Optional handle to Vulkan instance object.

Optional, can be null. Must be set if VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT flas is used or if vulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0).

◆ pAllocationCallbacks

const VkAllocationCallbacks* VmaAllocatorCreateInfo::pAllocationCallbacks

Custom CPU memory allocation callbacks. Optional.

Optional, can be null. When specified, will also be used for all CPU-side memory allocations.

◆ pDeviceMemoryCallbacks

const VmaDeviceMemoryCallbacks* VmaAllocatorCreateInfo::pDeviceMemoryCallbacks

Informative callbacks for vkAllocateMemory, vkFreeMemory. Optional.

Optional, can be null.

◆ pHeapSizeLimit

const VkDeviceSize* VmaAllocatorCreateInfo::pHeapSizeLimit

Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap.

If not NULL, it must be a pointer to an array of VkPhysicalDeviceMemoryProperties::memoryHeapCount elements, defining limit on maximum number of bytes that can be allocated out of particular Vulkan memory heap.

Any of the elements may be equal to VK_WHOLE_SIZE, which means no limit on that heap. This is also the default in case of pHeapSizeLimit = NULL.

If there is a limit defined for a heap:

  • If user tries to allocate more memory from that heap using this allocator, the allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY.
  • If the limit is smaller than heap size reported in VkMemoryHeap::size, the value of this limit will be reported instead when using vmaGetMemoryProperties().

Warning! Using this feature may not be equivalent to installing a GPU with smaller amount of memory, because graphics driver doesn't necessary fail new allocations with VK_ERROR_OUT_OF_DEVICE_MEMORY result when memory capacity is exceeded. It may return success and just silently migrate some device memory blocks to system RAM. This driver behavior can also be controlled using VK_AMD_memory_overallocation_behavior extension.

◆ physicalDevice

VkPhysicalDevice VmaAllocatorCreateInfo::physicalDevice

Vulkan physical device.

It must be valid throughout whole lifetime of created allocator.

◆ pRecordSettings

const VmaRecordSettings* VmaAllocatorCreateInfo::pRecordSettings

Parameters for recording of VMA calls. Can be null.

If not null, it enables recording of calls to VMA functions to a file. If support for recording is not enabled using VMA_RECORDING_ENABLED macro, creation of the allocator object fails with VK_ERROR_FEATURE_NOT_PRESENT.

◆ preferredLargeHeapBlockSize

VkDeviceSize VmaAllocatorCreateInfo::preferredLargeHeapBlockSize

Preferred size of a single VkDeviceMemory block to be allocated from large heaps > 1 GiB. Optional.

Set to 0 to use default, which is currently 256 MiB.

◆ pVulkanFunctions

const VmaVulkanFunctions* VmaAllocatorCreateInfo::pVulkanFunctions

Pointers to Vulkan functions. Can be null if you leave define VMA_STATIC_VULKAN_FUNCTIONS 1.

If you leave define VMA_STATIC_VULKAN_FUNCTIONS 1 in configuration section, you can pass null as this member, because the library will fetch pointers to Vulkan functions internally in a static way, like:

vulkanFunctions.vkAllocateMemory = &vkAllocateMemory;

Fill this member if you want to provide your own pointers to Vulkan functions, e.g. fetched using vkGetInstanceProcAddr() and vkGetDeviceProcAddr().

◆ vulkanApiVersion

uint32_t VmaAllocatorCreateInfo::vulkanApiVersion

Optional. The highest version of Vulkan that the application is designed to use.

It must be a value in the format as created by macro VK_MAKE_VERSION or a constant like: VK_API_VERSION_1_1, VK_API_VERSION_1_0. The patch version number specified is ignored. Only the major and minor versions are considered. It must be less or euqal (preferably equal) to value as passed to vkCreateInstance as VkApplicationInfo::apiVersion. Only versions 1.0 and 1.1 are supported by the current implementation. Leaving it initialized to zero is equivalent to VK_API_VERSION_1_0.


The documentation for this struct was generated from the following file: