Class VmaAllocatorCreateInfo

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

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

Layout


 struct VmaAllocatorCreateInfo {
     VmaAllocatorCreateFlags flags();
     VkPhysicalDevice physicalDevice();
     VkDevice device();
     VkDeviceSize preferredLargeHeapBlockSize();
     VkAllocationCallbacks const * pAllocationCallbacks();
     VmaDeviceMemoryCallbacks const * pDeviceMemoryCallbacks();
     VkDeviceSize const * pHeapSizeLimit(int);
     VmaVulkanFunctions const * pVulkanFunctions();
     VkInstance instance();
     uint32_t vulkanApiVersion();
     VkExternalMemoryHandleTypeFlagsKHR const * pTypeExternalMemoryHandleTypes(int);
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • FLAGS

      public static final int FLAGS
      The struct member offsets.
    • PHYSICALDEVICE

      public static final int PHYSICALDEVICE
      The struct member offsets.
    • DEVICE

      public static final int DEVICE
      The struct member offsets.
    • PREFERREDLARGEHEAPBLOCKSIZE

      public static final int PREFERREDLARGEHEAPBLOCKSIZE
      The struct member offsets.
    • PALLOCATIONCALLBACKS

      public static final int PALLOCATIONCALLBACKS
      The struct member offsets.
    • PDEVICEMEMORYCALLBACKS

      public static final int PDEVICEMEMORYCALLBACKS
      The struct member offsets.
    • PHEAPSIZELIMIT

      public static final int PHEAPSIZELIMIT
      The struct member offsets.
    • PVULKANFUNCTIONS

      public static final int PVULKANFUNCTIONS
      The struct member offsets.
    • INSTANCE

      public static final int INSTANCE
      The struct member offsets.
    • VULKANAPIVERSION

      public static final int VULKANAPIVERSION
      The struct member offsets.
    • PTYPEEXTERNALMEMORYHANDLETYPES

      public static final int PTYPEEXTERNALMEMORYHANDLETYPES
      The struct member offsets.
  • Constructor Details

    • VmaAllocatorCreateInfo

      public VmaAllocatorCreateInfo(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 Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<VmaAllocatorCreateInfo>
    • flags

      public int flags()
    • physicalDevice

      public long physicalDevice()
      Vulkan physical device. It must be valid throughout whole lifetime of created allocator.
    • device

      public long device()
      Vulkan device. It must be valid throughout whole lifetime of created allocator.
    • preferredLargeHeapBlockSize

      public long 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

      @Nullable public VkAllocationCallbacks pAllocationCallbacks()
      custom CPU memory allocation callbacks. Optional, can be null. When specified, will also be used for all CPU-side memory allocations. Optional.
    • pDeviceMemoryCallbacks

      @Nullable public VmaDeviceMemoryCallbacks pDeviceMemoryCallbacks()
      informative callbacks for vkAllocateMemory, vkFreeMemory. Optional.
    • pHeapSizeLimit

      @Nullable public LongBuffer pHeapSizeLimit(int capacity)
      Parameters:
      capacity - the number of elements in the returned buffer
      Returns:
      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

      public VmaVulkanFunctions pVulkanFunctions()
      pointers to Vulkan functions
    • instance

      public long instance()
      handle to Vulkan instance object.
    • vulkanApiVersion

      public int vulkanApiVersion()
      the highest version of Vulkan that the application is designed to use. (optional)

      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, 1.1, 1.2 and 1.3 are supported by the current implementation.

      Leaving it initialized to zero is equivalent to VK_API_VERSION_1_0.

    • pTypeExternalMemoryHandleTypes

      @Nullable public IntBuffer pTypeExternalMemoryHandleTypes(int capacity)
      Parameters:
      capacity - the number of elements in the returned buffer
      Returns:
      Either null or a pointer to an array of external memory handle types for each Vulkan memory type.

      If not NULL, it must be a pointer to an array of VkPhysicalDeviceMemoryProperties::memoryTypeCount elements, defining external memory handle types of particular Vulkan memory type, to be passed using VkExportMemoryAllocateInfoKHR.

      Any of the elements may be equal to 0, which means not to use VkExportMemoryAllocateInfoKHR on this memory type. This is also the default in case of pTypeExternalMemoryHandleTypes = NULL.

    • flags

      public VmaAllocatorCreateInfo flags(int value)
      Sets the specified value to the flags() field.
    • physicalDevice

      public VmaAllocatorCreateInfo physicalDevice(VkPhysicalDevice value)
      Sets the specified value to the physicalDevice() field.
    • device

      public VmaAllocatorCreateInfo device(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 VkAllocationCallbacks value)
      Sets the address of the specified VkAllocationCallbacks to the pAllocationCallbacks() field.
    • pDeviceMemoryCallbacks

      public VmaAllocatorCreateInfo pDeviceMemoryCallbacks(@Nullable VmaDeviceMemoryCallbacks value)
      Sets the address of the specified VmaDeviceMemoryCallbacks to the pDeviceMemoryCallbacks() field.
    • pHeapSizeLimit

      public VmaAllocatorCreateInfo pHeapSizeLimit(@Nullable LongBuffer value)
      Sets the address of the specified LongBuffer to the pHeapSizeLimit(int) field.
    • pVulkanFunctions

      public VmaAllocatorCreateInfo pVulkanFunctions(VmaVulkanFunctions value)
      Sets the address of the specified VmaVulkanFunctions to the pVulkanFunctions() field.
    • instance

      public VmaAllocatorCreateInfo instance(VkInstance value)
      Sets the specified value to the instance() field.
    • vulkanApiVersion

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

      public VmaAllocatorCreateInfo pTypeExternalMemoryHandleTypes(@Nullable IntBuffer value)
      Sets the address of the specified IntBuffer to the pTypeExternalMemoryHandleTypes(int) field.
    • set

      public VmaAllocatorCreateInfo set(int flags, VkPhysicalDevice physicalDevice, VkDevice device, long preferredLargeHeapBlockSize, @Nullable VkAllocationCallbacks pAllocationCallbacks, @Nullable VmaDeviceMemoryCallbacks pDeviceMemoryCallbacks, @Nullable LongBuffer pHeapSizeLimit, VmaVulkanFunctions pVulkanFunctions, VkInstance instance, int vulkanApiVersion, @Nullable IntBuffer pTypeExternalMemoryHandleTypes)
      Initializes this struct with the specified values.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • 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

      @Deprecated public static VmaAllocatorCreateInfo mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VmaAllocatorCreateInfo callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static VmaAllocatorCreateInfo mallocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VmaAllocatorCreateInfo callocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • malloc

      public static VmaAllocatorCreateInfo malloc(MemoryStack stack)
      Returns a new VmaAllocatorCreateInfo instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static VmaAllocatorCreateInfo calloc(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 VkAllocationCallbacks npAllocationCallbacks(long struct)
      Unsafe version of pAllocationCallbacks().
    • npDeviceMemoryCallbacks

      @Nullable public static VmaDeviceMemoryCallbacks npDeviceMemoryCallbacks(long struct)
      Unsafe version of pDeviceMemoryCallbacks().
    • npHeapSizeLimit

      @Nullable public static LongBuffer npHeapSizeLimit(long struct, int capacity)
      Unsafe version of pHeapSizeLimit.
    • npVulkanFunctions

      public static VmaVulkanFunctions npVulkanFunctions(long struct)
      Unsafe version of pVulkanFunctions().
    • ninstance

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

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

      @Nullable public static IntBuffer npTypeExternalMemoryHandleTypes(long struct, int capacity)
    • nflags

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

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

      public static void ndevice(long struct, 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 VkAllocationCallbacks value)
      Unsafe version of pAllocationCallbacks.
    • npDeviceMemoryCallbacks

      public static void npDeviceMemoryCallbacks(long struct, @Nullable VmaDeviceMemoryCallbacks value)
      Unsafe version of pDeviceMemoryCallbacks.
    • npHeapSizeLimit

      public static void npHeapSizeLimit(long struct, @Nullable LongBuffer value)
      Unsafe version of pHeapSizeLimit.
    • npVulkanFunctions

      public static void npVulkanFunctions(long struct, VmaVulkanFunctions value)
      Unsafe version of pVulkanFunctions.
    • ninstance

      public static void ninstance(long struct, VkInstance value)
      Unsafe version of instance.
    • nvulkanApiVersion

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

      public static void npTypeExternalMemoryHandleTypes(long struct, @Nullable IntBuffer value)
    • validate

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