Class VMAAllocationInfo
java.lang.Object
com.io7m.jcoronado.vma.VMAAllocationInfo
- All Implemented Interfaces:
VMAAllocationInfoType
Information about an allocation. This is an immutable snapshot of an allocation.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic VMAAllocationInfo.Builder
builder()
Creates a builder forVMAAllocationInfo
.static VMAAllocationInfo
copyOf
(VMAAllocationInfoType instance) Creates an immutable copy of aVMAAllocationInfoType
value.boolean
This instance is equal to all instances ofVMAAllocationInfo
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:memoryType
,deviceMemory
,offset
,size
.long
static VMAAllocationInfo
of
(long memoryType, Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size) Construct a new immutableVMAAllocationInfo
instance.long
offset()
long
size()
toString()
Prints the immutable valueVMAAllocationInfo
with attribute values.final VMAAllocationInfo
Copy the current immutable object by setting a present value for the optionaldeviceMemory
attribute.final VMAAllocationInfo
withDeviceMemory
(Optional<? extends VulkanDeviceMemoryType> optional) Copy the current immutable object by setting an optional value for thedeviceMemory
attribute.final VMAAllocationInfo
withMemoryType
(long value) Copy the current immutable object by setting a value for thememoryType
attribute.final VMAAllocationInfo
withOffset
(long value) Copy the current immutable object by setting a value for theoffset
attribute.final VMAAllocationInfo
withSize
(long value) Copy the current immutable object by setting a value for thesize
attribute.
-
Method Details
-
memoryType
public long memoryType()- Specified by:
memoryType
in interfaceVMAAllocationInfoType
- Returns:
- The memory type index that this allocation was allocated from.
-
deviceMemory
- Specified by:
deviceMemory
in interfaceVMAAllocationInfoType
- Returns:
- A handle to the Vulkan memory object. Same memory object can be shared by multiple allocations. It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost. If the allocation is lost, it is equal to `VK_NULL_HANDLE`.
-
offset
public long offset()- Specified by:
offset
in interfaceVMAAllocationInfoType
- Returns:
- The offset into the device memory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation. It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.
-
size
public long size()- Specified by:
size
in interfaceVMAAllocationInfoType
- Returns:
- The size of this allocation, in bytes. It never changes, unless allocation is lost.
-
withMemoryType
Copy the current immutable object by setting a value for thememoryType
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for memoryType- Returns:
- A modified copy of the
this
object
-
withDeviceMemory
Copy the current immutable object by setting a present value for the optionaldeviceMemory
attribute.- Parameters:
value
- The value for deviceMemory- Returns:
- A modified copy of
this
object
-
withDeviceMemory
public final VMAAllocationInfo withDeviceMemory(Optional<? extends VulkanDeviceMemoryType> optional) Copy the current immutable object by setting an optional value for thedeviceMemory
attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for deviceMemory- Returns:
- A modified copy of
this
object
-
withOffset
Copy the current immutable object by setting a value for theoffset
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for offset- Returns:
- A modified copy of the
this
object
-
withSize
Copy the current immutable object by setting a value for thesize
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for size- Returns:
- A modified copy of the
this
object
-
equals
-
hashCode
-
toString
-
of
public static VMAAllocationInfo of(long memoryType, Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size) Construct a new immutableVMAAllocationInfo
instance.- Parameters:
memoryType
- The value for thememoryType
attributedeviceMemory
- The value for thedeviceMemory
attributeoffset
- The value for theoffset
attributesize
- The value for thesize
attribute- Returns:
- An immutable VMAAllocationInfo instance
-
copyOf
Creates an immutable copy of aVMAAllocationInfoType
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable VMAAllocationInfo instance
-
builder
Creates a builder forVMAAllocationInfo
.VMAAllocationInfo.builder() .setMemoryType(long) // required
memoryType
.setDeviceMemory(com.io7m.jcoronado.api.VulkanDeviceMemoryType) // optionaldeviceMemory
.setOffset(long) // requiredoffset
.setSize(long) // requiredsize
.build();- Returns:
- A new VMAAllocationInfo builder
-