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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic VMAAllocationInfo.Builderbuilder()Creates a builder forVMAAllocationInfo.static VMAAllocationInfocopyOf(VMAAllocationInfoType instance) Creates an immutable copy of aVMAAllocationInfoTypevalue.booleanThis instance is equal to all instances ofVMAAllocationInfothat have equal attribute values.inthashCode()Computes a hash code from attributes:memoryType,deviceMemory,offset,size.longstatic VMAAllocationInfoof(long memoryType, Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size) Construct a new immutableVMAAllocationInfoinstance.longoffset()longsize()toString()Prints the immutable valueVMAAllocationInfowith attribute values.final VMAAllocationInfoCopy the current immutable object by setting a present value for the optionaldeviceMemoryattribute.final VMAAllocationInfowithDeviceMemory(Optional<? extends VulkanDeviceMemoryType> optional) Copy the current immutable object by setting an optional value for thedeviceMemoryattribute.final VMAAllocationInfowithMemoryType(long value) Copy the current immutable object by setting a value for thememoryTypeattribute.final VMAAllocationInfowithOffset(long value) Copy the current immutable object by setting a value for theoffsetattribute.final VMAAllocationInfowithSize(long value) Copy the current immutable object by setting a value for thesizeattribute.
-
Method Details
-
memoryType
public long memoryType()- Specified by:
memoryTypein interfaceVMAAllocationInfoType- Returns:
- The memory type index that this allocation was allocated from.
-
deviceMemory
- Specified by:
deviceMemoryin 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:
offsetin 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:
sizein 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 thememoryTypeattribute. 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
thisobject
-
withDeviceMemory
Copy the current immutable object by setting a present value for the optionaldeviceMemoryattribute.- Parameters:
value- The value for deviceMemory- Returns:
- A modified copy of
thisobject
-
withDeviceMemory
public final VMAAllocationInfo withDeviceMemory(Optional<? extends VulkanDeviceMemoryType> optional) Copy the current immutable object by setting an optional value for thedeviceMemoryattribute. 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
thisobject
-
withOffset
Copy the current immutable object by setting a value for theoffsetattribute. 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
thisobject
-
withSize
Copy the current immutable object by setting a value for thesizeattribute. 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
thisobject
-
equals
-
hashCode
-
toString
-
of
public static VMAAllocationInfo of(long memoryType, Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size) Construct a new immutableVMAAllocationInfoinstance.- Parameters:
memoryType- The value for thememoryTypeattributedeviceMemory- The value for thedeviceMemoryattributeoffset- The value for theoffsetattributesize- The value for thesizeattribute- Returns:
- An immutable VMAAllocationInfo instance
-
copyOf
Creates an immutable copy of aVMAAllocationInfoTypevalue. 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) // requiredmemoryType.setDeviceMemory(com.io7m.jcoronado.api.VulkanDeviceMemoryType) // optionaldeviceMemory.setOffset(long) // requiredoffset.setSize(long) // requiredsize.build();- Returns:
- A new VMAAllocationInfo builder
-