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. usingvkCmdCopyBuffer
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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Represents a pointer to / an array of null structure(s) in native memory. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
static final StructLayout
static final AddressLayout
static final ValueLayout.OfInt
static final ValueLayout.OfLong
static final AddressLayout
static final AddressLayout
static final AddressLayout
static final ValueLayout.OfLong
static final long
static final long
static final long
static final long
static final long
static final long
static final long
static final MemoryLayout.PathElement
static final MemoryLayout.PathElement
static final MemoryLayout.PathElement
static final MemoryLayout.PathElement
static final MemoryLayout.PathElement
static final MemoryLayout.PathElement
static final MemoryLayout.PathElement
static final long
static final long
static final long
static final long
static final long
static final long
static final long
-
Constructor Summary
ConstructorsConstructorDescriptionVmaAllocationInfo
(@NotNull MemorySegment segment) Creates an instance of aVmaAllocationInfo
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic VmaAllocationInfo
static VmaAllocationInfo.Ptr
static VmaAllocationInfo
clone
(Arena arena, VmaAllocationInfo src) @Nullable VkDeviceMemory
deviceMemory
(@Nullable VkDeviceMemory value) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
memoryType
(int value) long
offset()
offset
(long value) pMappedData
(@Nullable IPointer pointer) void
pMappedData
(MemorySegment value) @Nullable BytePtr
pName()
Note: the returnedBytePtr
does not have correctBytePtr.size()
property.pNameRaw()
void
pNameRaw
(MemorySegment value) void
pUserData
(MemorySegment value) @NotNull MemorySegment
segment()
Returns the value of thesegment
record component.long
size()
size
(long value) final String
toString()
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 aVmaAllocationInfo
record class.- Parameters:
segment
- the value for thesegment
record component
-
-
Method Details
-
allocate
-
allocate
-
clone
-
memoryType
-
memoryType
-
deviceMemory
-
deviceMemory
-
offset
-
offset
-
size
-
size
-
pMappedData
-
pMappedData
-
pMappedData
-
pUserData
-
pUserData
-
pUserData
-
pName
Note: the returnedBytePtr
does 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 thesegment
record component.
-