Record Class VmaAllocationInfo
- All Implemented Interfaces:
IPointer,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. usingvkCmdCopyBuffermust 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_BITflag, 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_BITset (deprecated).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a pointer to / an array of null structure(s) in native memory. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final StructLayoutstatic final AddressLayoutstatic final ValueLayout.OfIntstatic final ValueLayout.OfLongstatic final AddressLayoutstatic final AddressLayoutstatic final AddressLayoutstatic final ValueLayout.OfLongstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final MemoryLayout.PathElementstatic final MemoryLayout.PathElementstatic final MemoryLayout.PathElementstatic final MemoryLayout.PathElementstatic final MemoryLayout.PathElementstatic final MemoryLayout.PathElementstatic final MemoryLayout.PathElementstatic final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final long -
Constructor Summary
ConstructorsConstructorDescriptionVmaAllocationInfo(@NotNull MemorySegment segment) Creates an instance of aVmaAllocationInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic VmaAllocationInfostatic VmaAllocationInfo.Ptrstatic VmaAllocationInfoclone(Arena arena, VmaAllocationInfo src) @Nullable VkDeviceMemorydeviceMemory(@Nullable VkDeviceMemory value) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmemoryType(int value) longoffset()offset(long value) @NotNull MemorySegmentpMappedData(@Nullable IPointer pointer) pMappedData(@NotNull MemorySegment value) @Nullable BytePtrpName()Note: the returnedBytePtrdoes not have correctBytePtr.size()property.@NotNull MemorySegmentpNameRaw()voidpNameRaw(@NotNull MemorySegment value) @NotNull MemorySegmentpUserData(@NotNull MemorySegment value) @NotNull MemorySegmentsegment()Returns the value of thesegmentrecord component.longsize()size(long value) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
LAYOUT
-
BYTES
public static final long BYTES -
PATH$memoryType
-
PATH$deviceMemory
-
PATH$offset
-
PATH$size
-
PATH$pMappedData
-
PATH$pUserData
-
PATH$pName
-
LAYOUT$memoryType
-
LAYOUT$deviceMemory
-
LAYOUT$offset
-
LAYOUT$size
-
LAYOUT$pMappedData
-
LAYOUT$pUserData
-
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
Creates an instance of aVmaAllocationInforecord class.- Parameters:
segment- the value for thesegmentrecord component
-
-
Method Details
-
allocate
-
allocate
-
clone
-
memoryType
-
memoryType
-
deviceMemory
-
deviceMemory
-
offset
-
offset
-
size
-
size
-
pMappedData
-
pMappedData
public VmaAllocationInfo pMappedData(@Pointer(comment="void*") @NotNull @NotNull MemorySegment value) -
pMappedData
-
pUserData
-
pUserData
-
pUserData
-
pName
Note: the returnedBytePtrdoes not have correctBytePtr.size()property. It's up to user to track the size of the buffer, and useBytePtr.reinterpret(long)to set the size before actually reading from or writing to the buffer. -
pName
-
pNameRaw
-
pNameRaw
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
segment
Returns the value of thesegmentrecord component.
-