Class VmaAllocatorCreateInfo

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class VmaAllocatorCreateInfo
    extends Struct
    implements NativeResource
    Description of an Allocator to be created.

    Member documentation

    • flags – flags for created allocator. Use VmaAllocatorCreateFlagBits enum. One of:
      ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT
      ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT
    • physicalDevice – Vulkan physical device. It must be valid throughout whole lifetime of created allocator.
    • device – Vulkan device. It must be valid throughout whole lifetime of created allocator.
    • preferredLargeHeapBlockSize – preferred size of a single VkDeviceMemory block to be allocated from large heaps > 1 GiB. Set to 0 to use default, which is currently 256 MiB. Optional.
    • pAllocationCallbacks – custom CPU memory allocation callbacks. Optional, can be null. When specified, will also be used for all CPU-side memory allocations. Optional.
    • pDeviceMemoryCallbacks – informative callbacks for vkAllocateMemory, vkFreeMemory. Optional.
    • 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 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.

    • 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 GetMemoryProperties.

      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.

    • pVulkanFunctions – pointers to Vulkan functions

    Layout

    
     struct VmaAllocatorCreateInfo {
         VmaAllocatorCreateFlags flags;
         VkPhysicalDevice physicalDevice;
         VkDevice device;
         VkDeviceSize preferredLargeHeapBlockSize;
         VkAllocationCallbacks const * pAllocationCallbacks;
         VmaDeviceMemoryCallbacks const * pDeviceMemoryCallbacks;
         uint32_t frameInUseCount;
         VkDeviceSize const * pHeapSizeLimit;
         VmaVulkanFunctions const * pVulkanFunctions;
     }