Class VmaAllocatorCreateInfo

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

    public class VmaAllocatorCreateInfo
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.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
      ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT
      ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_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. This driver behavior can also be controlled using VK_AMD_memory_overallocation_behavior extension.

    • pVulkanFunctions – pointers to Vulkan functions
    • 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.

    • instance – Optional handle to Vulkan instance object.

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

    • 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 equal (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.

    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;
         VmaRecordSettings const * pRecordSettings;
         VkInstance instance;
         uint32_t vulkanApiVersion;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • FLAGS, PHYSICALDEVICE, DEVICE, PREFERREDLARGEHEAPBLOCKSIZE, PALLOCATIONCALLBACKS, PDEVICEMEMORYCALLBACKS, FRAMEINUSECOUNT, PHEAPSIZELIMIT, PVULKANFUNCTIONS, PRECORDSETTINGS, INSTANCE, VULKANAPIVERSION

        The struct member offsets.
    • Constructor Detail

      • VmaAllocatorCreateInfo

        public VmaAllocatorCreateInfo​(java.nio.ByteBuffer container)
        Creates a VmaAllocatorCreateInfo instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • flags

        public int flags()
        Returns the value of the flags field.
      • physicalDevice

        public long physicalDevice()
        Returns the value of the physicalDevice field.
      • device

        public long device()
        Returns the value of the device field.
      • preferredLargeHeapBlockSize

        public long preferredLargeHeapBlockSize()
        Returns the value of the preferredLargeHeapBlockSize field.
      • pAllocationCallbacks

        @Nullable
        public org.lwjgl.vulkan.VkAllocationCallbacks pAllocationCallbacks()
        Returns a VkAllocationCallbacks view of the struct pointed to by the pAllocationCallbacks field.
      • frameInUseCount

        public int frameInUseCount()
        Returns the value of the frameInUseCount field.
      • pHeapSizeLimit

        @Nullable
        public java.nio.LongBuffer pHeapSizeLimit​(int capacity)
        Returns a LongBuffer view of the data pointed to by the pHeapSizeLimit field.
        Parameters:
        capacity - the number of elements in the returned buffer
      • instance

        @Nullable
        public long instance()
        Returns the value of the instance field.
      • vulkanApiVersion

        public int vulkanApiVersion()
        Returns the value of the vulkanApiVersion field.
      • physicalDevice

        public VmaAllocatorCreateInfo physicalDevice​(org.lwjgl.vulkan.VkPhysicalDevice value)
        Sets the specified value to the physicalDevice field.
      • device

        public VmaAllocatorCreateInfo device​(org.lwjgl.vulkan.VkDevice value)
        Sets the specified value to the device field.
      • preferredLargeHeapBlockSize

        public VmaAllocatorCreateInfo preferredLargeHeapBlockSize​(long value)
        Sets the specified value to the preferredLargeHeapBlockSize field.
      • pAllocationCallbacks

        public VmaAllocatorCreateInfo pAllocationCallbacks​(@Nullable
                                                           org.lwjgl.vulkan.VkAllocationCallbacks value)
        Sets the address of the specified VkAllocationCallbacks to the pAllocationCallbacks field.
      • frameInUseCount

        public VmaAllocatorCreateInfo frameInUseCount​(int value)
        Sets the specified value to the frameInUseCount field.
      • pHeapSizeLimit

        public VmaAllocatorCreateInfo pHeapSizeLimit​(@Nullable
                                                     java.nio.LongBuffer value)
        Sets the address of the specified LongBuffer to the pHeapSizeLimit field.
      • instance

        public VmaAllocatorCreateInfo instance​(@Nullable
                                               org.lwjgl.vulkan.VkInstance value)
        Sets the specified value to the instance field.
      • vulkanApiVersion

        public VmaAllocatorCreateInfo vulkanApiVersion​(int value)
        Sets the specified value to the vulkanApiVersion field.
      • set

        public VmaAllocatorCreateInfo set​(int flags,
                                          org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
                                          org.lwjgl.vulkan.VkDevice device,
                                          long preferredLargeHeapBlockSize,
                                          @Nullable
                                          org.lwjgl.vulkan.VkAllocationCallbacks pAllocationCallbacks,
                                          @Nullable
                                          VmaDeviceMemoryCallbacks pDeviceMemoryCallbacks,
                                          int frameInUseCount,
                                          @Nullable
                                          java.nio.LongBuffer pHeapSizeLimit,
                                          VmaVulkanFunctions pVulkanFunctions,
                                          @Nullable
                                          VmaRecordSettings pRecordSettings,
                                          @Nullable
                                          org.lwjgl.vulkan.VkInstance instance,
                                          int vulkanApiVersion)
        Initializes this struct with the specified values.
      • malloc

        public static VmaAllocatorCreateInfo malloc()
        Returns a new VmaAllocatorCreateInfo instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static VmaAllocatorCreateInfo calloc()
        Returns a new VmaAllocatorCreateInfo instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static VmaAllocatorCreateInfo create()
        Returns a new VmaAllocatorCreateInfo instance allocated with BufferUtils.
      • create

        public static VmaAllocatorCreateInfo create​(long address)
        Returns a new VmaAllocatorCreateInfo instance for the specified memory address.
      • createSafe

        @Nullable
        public static VmaAllocatorCreateInfo createSafe​(long address)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static VmaAllocatorCreateInfo mallocStack()
        Returns a new VmaAllocatorCreateInfo instance allocated on the thread-local MemoryStack.
      • callocStack

        public static VmaAllocatorCreateInfo callocStack()
        Returns a new VmaAllocatorCreateInfo instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static VmaAllocatorCreateInfo mallocStack​(org.lwjgl.system.MemoryStack stack)
        Returns a new VmaAllocatorCreateInfo instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static VmaAllocatorCreateInfo callocStack​(org.lwjgl.system.MemoryStack stack)
        Returns a new VmaAllocatorCreateInfo instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • nflags

        public static int nflags​(long struct)
        Unsafe version of flags().
      • nphysicalDevice

        public static long nphysicalDevice​(long struct)
        Unsafe version of physicalDevice().
      • ndevice

        public static long ndevice​(long struct)
        Unsafe version of device().
      • npreferredLargeHeapBlockSize

        public static long npreferredLargeHeapBlockSize​(long struct)
      • npAllocationCallbacks

        @Nullable
        public static org.lwjgl.vulkan.VkAllocationCallbacks npAllocationCallbacks​(long struct)
        Unsafe version of pAllocationCallbacks().
      • nframeInUseCount

        public static int nframeInUseCount​(long struct)
        Unsafe version of frameInUseCount().
      • npHeapSizeLimit

        @Nullable
        public static java.nio.LongBuffer npHeapSizeLimit​(long struct,
                                                          int capacity)
        Unsafe version of pHeapSizeLimit.
      • ninstance

        public static long ninstance​(long struct)
        Unsafe version of instance().
      • nvulkanApiVersion

        public static int nvulkanApiVersion​(long struct)
        Unsafe version of vulkanApiVersion().
      • nflags

        public static void nflags​(long struct,
                                  int value)
        Unsafe version of flags.
      • nphysicalDevice

        public static void nphysicalDevice​(long struct,
                                           org.lwjgl.vulkan.VkPhysicalDevice value)
        Unsafe version of physicalDevice.
      • ndevice

        public static void ndevice​(long struct,
                                   org.lwjgl.vulkan.VkDevice value)
        Unsafe version of device.
      • npreferredLargeHeapBlockSize

        public static void npreferredLargeHeapBlockSize​(long struct,
                                                        long value)
        Unsafe version of preferredLargeHeapBlockSize.
      • npAllocationCallbacks

        public static void npAllocationCallbacks​(long struct,
                                                 @Nullable
                                                 org.lwjgl.vulkan.VkAllocationCallbacks value)
        Unsafe version of pAllocationCallbacks.
      • nframeInUseCount

        public static void nframeInUseCount​(long struct,
                                            int value)
        Unsafe version of frameInUseCount.
      • npHeapSizeLimit

        public static void npHeapSizeLimit​(long struct,
                                           @Nullable
                                           java.nio.LongBuffer value)
        Unsafe version of pHeapSizeLimit.
      • ninstance

        public static void ninstance​(long struct,
                                     @Nullable
                                     org.lwjgl.vulkan.VkInstance value)
        Unsafe version of instance.
      • nvulkanApiVersion

        public static void nvulkanApiVersion​(long struct,
                                             int value)
        Unsafe version of vulkanApiVersion.
      • validate

        public static void validate​(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array