Record Class VmaAllocationInfo

java.lang.Object
java.lang.Record
club.doki7.vma.datatype.VmaAllocationInfo
All Implemented Interfaces:
IPointer, IVmaAllocationInfo

@ValueBasedCandidate @UnsafeConstructor public record VmaAllocationInfo(@NotNull MemorySegment segment) extends Record implements IVmaAllocationInfo

Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().

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

Structure

typedef struct VmaAllocationInfo {
    uint32_t memoryType;
    VkDeviceMemory deviceMemory; // optional
    VkDeviceSize offset;
    VkDeviceSize size;
    void* pMappedData; // optional
    void* pUserData; // optional
    char const* pName; // optional
} VmaAllocationInfo;

Contracts

The property segment() should always be not-null (segment != NULL && !segment.equals(MemorySegment.NULL)), and properly aligned to LAYOUT.byteAlignment() bytes. To represent null pointer, you may use a Java null instead. See the documentation of IPointer.segment() for more details.

The constructor of this class is marked as UnsafeConstructor, because it does not perform any runtime check. The constructor can be useful for automatic code generators.

Member documentation

  • memoryType() Memory type index that this allocation was allocated from.

    It never changes.

  • 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() 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 vmaCreateBuffer(), vmaCreateImage(), functions that operate on these resources refer to the beginning of the buffer or image, not entire device memory block. Functions like vmaMapMemory(), vmaBindBufferMemory() also refer to the beginning of the allocation and apply this offset automatically.

    It can change after the allocation is moved during defragmentation.

  • size() Size of this allocation, in bytes.

    It never changes.

    ote 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 vmaMapMemory(), but operations on the resource e.g. using vkCmdCopyBuffer must be limited to the size of the resource.

  • pMappedData() Pointer to the beginning of this allocation as mapped data.

    If the allocation hasn't been mapped using vmaMapMemory() and hasn't been created with VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.

    It can change after call to vmaMapMemory(), vmaUnmapMemory(). It can also change after the allocation is moved during defragmentation.

  • pUserData() Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vmaSetAllocationUserData().

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

  • pName() Custom allocation name that was set with vmaSetAllocationName().

    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 VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set (deprecated).

  • Field Details

    • LAYOUT

      public static final StructLayout LAYOUT
    • BYTES

      public static final long BYTES
    • PATH$memoryType

      public static final MemoryLayout.PathElement PATH$memoryType
    • PATH$deviceMemory

      public static final MemoryLayout.PathElement PATH$deviceMemory
    • PATH$offset

      public static final MemoryLayout.PathElement PATH$offset
    • PATH$size

      public static final MemoryLayout.PathElement PATH$size
    • PATH$pMappedData

      public static final MemoryLayout.PathElement PATH$pMappedData
    • PATH$pUserData

      public static final MemoryLayout.PathElement PATH$pUserData
    • PATH$pName

      public static final MemoryLayout.PathElement PATH$pName
    • LAYOUT$memoryType

      public static final ValueLayout.OfInt LAYOUT$memoryType
    • LAYOUT$deviceMemory

      public static final AddressLayout LAYOUT$deviceMemory
    • LAYOUT$offset

      public static final ValueLayout.OfLong LAYOUT$offset
    • LAYOUT$size

      public static final ValueLayout.OfLong LAYOUT$size
    • LAYOUT$pMappedData

      public static final AddressLayout LAYOUT$pMappedData
    • LAYOUT$pUserData

      public static final AddressLayout LAYOUT$pUserData
    • LAYOUT$pName

      public static final AddressLayout LAYOUT$pName
    • SIZE$memoryType

      public static final long SIZE$memoryType
    • SIZE$deviceMemory

      public static final long SIZE$deviceMemory
    • SIZE$offset

      public static final long SIZE$offset
    • SIZE$size

      public static final long SIZE$size
    • SIZE$pMappedData

      public static final long SIZE$pMappedData
    • SIZE$pUserData

      public static final long SIZE$pUserData
    • SIZE$pName

      public static final long SIZE$pName
    • OFFSET$memoryType

      public static final long OFFSET$memoryType
    • OFFSET$deviceMemory

      public static final long OFFSET$deviceMemory
    • OFFSET$offset

      public static final long OFFSET$offset
    • OFFSET$size

      public static final long OFFSET$size
    • OFFSET$pMappedData

      public static final long OFFSET$pMappedData
    • OFFSET$pUserData

      public static final long OFFSET$pUserData
    • OFFSET$pName

      public static final long OFFSET$pName
  • Constructor Details

    • VmaAllocationInfo

      public VmaAllocationInfo(@NotNull @NotNull MemorySegment segment)
      Creates an instance of a VmaAllocationInfo record class.
      Parameters:
      segment - the value for the segment record component
  • Method Details