Class VmaAllocationInfo

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<VmaAllocationInfo>
org.lwjgl.util.vma.VmaAllocationInfo
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class VmaAllocationInfo extends org.lwjgl.system.Struct<VmaAllocationInfo> implements org.lwjgl.system.NativeResource
Parameters of VmaAllocation objects, that can be retrieved using function GetAllocationInfo.

There is also an extended version of this structure that carries additional parameters: VmaAllocationInfo2.

Layout


 struct VmaAllocationInfo {
     uint32_t memoryType();
     VkDeviceMemory deviceMemory();
     VkDeviceSize offset();
     VkDeviceSize size();
     void * pMappedData();
     void * pUserData();
     char const * pName();
 }
  • Field Details

    • SIZEOF

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

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

      public static final int MEMORYTYPE
      The struct member offsets.
    • DEVICEMEMORY

      public static final int DEVICEMEMORY
      The struct member offsets.
    • OFFSET

      public static final int OFFSET
      The struct member offsets.
    • SIZE

      public static final int SIZE
      The struct member offsets.
    • PMAPPEDDATA

      public static final int PMAPPEDDATA
      The struct member offsets.
    • PUSERDATA

      public static final int PUSERDATA
      The struct member offsets.
    • PNAME

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

    • VmaAllocationInfo

      public VmaAllocationInfo(ByteBuffer container)
      Creates a VmaAllocationInfo 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()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<VmaAllocationInfo>
    • memoryType

      public int memoryType()
      memory type index that this allocation was allocated from.

      It never changes.

    • deviceMemory

      public long deviceMemory()
      handle to Vulkan memory object.

      Same memory object can be shared by multiple allocations.

      It can change after the allocation is moved during defragmentation.

    • offset

      public long offset()
      offset in VkDeviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation.

      You usually don't need to use this offset. If you create a buffer or an image together with the allocation using e.g. function CreateBuffer, CreateImage, functions that operate on these resources refer to the beginning of the buffer or image, not entire device memory block. Functions like MapMemory, BindBufferMemory also refer to the beginning of the allocation and apply this offset automatically.

      It can change after the allocation is moved during defragmentation.

    • size

      public long size()
      size of this allocation, in bytes.

      It never changes.

      Note

      Allocation size returned in this variable may be greater than the size requested for the resource e.g. as VkBufferCreateInfo::size. Whole size of the allocation is accessible for operations on memory e.g. using a pointer after mapping with MapMemory, but operations on the resource e.g. using vkCmdCopyBuffer must be limited to the size of the resource.

    • pMappedData

      public long pMappedData()
      pointer to the beginning of this allocation as mapped data.

      If the allocation hasn't been mapped using MapMemory and hasn't been created with ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.

      It can change after call to MapMemory, UnmapMemory. It can also change after the allocation is moved during defragmentation.

    • pUserData

      public long pUserData()
      custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using SetAllocationUserData.

      It can change after call to SetAllocationUserData for this allocation.

    • pName

      public @Nullable ByteBuffer pName()
      Custom allocation name that was set with SetAllocationName.

      It can change after call to vmaSetAllocationName() for this allocation.

      Another way to set custom name is to pass it in VmaAllocationCreateInfo::pUserData with additional flag ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set (DEPRECATED).

    • pNameString

      public @Nullable String pNameString()
      Custom allocation name that was set with SetAllocationName.

      It can change after call to vmaSetAllocationName() for this allocation.

      Another way to set custom name is to pass it in VmaAllocationCreateInfo::pUserData with additional flag ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set (DEPRECATED).

    • malloc

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

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

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

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

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

      public static VmaAllocationInfo.Buffer malloc(int capacity)
      Returns a new VmaAllocationInfo.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static VmaAllocationInfo.Buffer calloc(int capacity)
      Returns a new VmaAllocationInfo.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VmaAllocationInfo.Buffer create(int capacity)
      Returns a new VmaAllocationInfo.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VmaAllocationInfo.Buffer create(long address, int capacity)
      Create a VmaAllocationInfo.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable VmaAllocationInfo.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • mallocStack

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

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

      @Deprecated public static VmaAllocationInfo mallocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VmaAllocationInfo callocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static VmaAllocationInfo.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static VmaAllocationInfo.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static VmaAllocationInfo.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static VmaAllocationInfo.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

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

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

      public static VmaAllocationInfo.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VmaAllocationInfo.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static VmaAllocationInfo.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VmaAllocationInfo.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nmemoryType

      public static int nmemoryType(long struct)
      Unsafe version of memoryType().
    • ndeviceMemory

      public static long ndeviceMemory(long struct)
      Unsafe version of deviceMemory().
    • noffset

      public static long noffset(long struct)
      Unsafe version of offset().
    • nsize

      public static long nsize(long struct)
      Unsafe version of size().
    • npMappedData

      public static long npMappedData(long struct)
      Unsafe version of pMappedData().
    • npUserData

      public static long npUserData(long struct)
      Unsafe version of pUserData().
    • npName

      public static @Nullable ByteBuffer npName(long struct)
      Unsafe version of pName().
    • npNameString

      public static @Nullable String npNameString(long struct)
      Unsafe version of pNameString().