Class VMAAllocationInfo

java.lang.Object
com.io7m.jcoronado.vma.VMAAllocationInfo
All Implemented Interfaces:
VMAAllocationInfoType

public final class VMAAllocationInfo extends Object implements VMAAllocationInfoType
Information about an allocation. This is an immutable snapshot of an allocation.
  • Method Details

    • memoryType

      public long memoryType()
      Specified by:
      memoryType in interface VMAAllocationInfoType
      Returns:
      The memory type index that this allocation was allocated from.
    • deviceMemory

      public Optional<VulkanDeviceMemoryType> deviceMemory()
      Specified by:
      deviceMemory in interface VMAAllocationInfoType
      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 interface VMAAllocationInfoType
      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 interface VMAAllocationInfoType
      Returns:
      The size of this allocation, in bytes. It never changes, unless allocation is lost.
    • withMemoryType

      public final VMAAllocationInfo withMemoryType(long value)
      Copy the current immutable object by setting a value for the memoryType attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for memoryType
      Returns:
      A modified copy of the this object
    • withDeviceMemory

      public final VMAAllocationInfo withDeviceMemory(VulkanDeviceMemoryType value)
      Copy the current immutable object by setting a present value for the optional deviceMemory 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 the deviceMemory attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for deviceMemory
      Returns:
      A modified copy of this object
    • withOffset

      public final VMAAllocationInfo withOffset(long value)
      Copy the current immutable object by setting a value for the offset attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for offset
      Returns:
      A modified copy of the this object
    • withSize

      public final VMAAllocationInfo withSize(long value)
      Copy the current immutable object by setting a value for the size attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for size
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of VMAAllocationInfo that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: memoryType, deviceMemory, offset, size.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value VMAAllocationInfo with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static VMAAllocationInfo of(long memoryType, Optional<? extends VulkanDeviceMemoryType> deviceMemory, long offset, long size)
      Construct a new immutable VMAAllocationInfo instance.
      Parameters:
      memoryType - The value for the memoryType attribute
      deviceMemory - The value for the deviceMemory attribute
      offset - The value for the offset attribute
      size - The value for the size attribute
      Returns:
      An immutable VMAAllocationInfo instance
    • copyOf

      public static VMAAllocationInfo copyOf(VMAAllocationInfoType instance)
      Creates an immutable copy of a VMAAllocationInfoType 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

      public static VMAAllocationInfo.Builder builder()
      Creates a builder for VMAAllocationInfo.
       VMAAllocationInfo.builder()
          .setMemoryType(long) // required memoryType
          .setDeviceMemory(com.io7m.jcoronado.api.VulkanDeviceMemoryType) // optional deviceMemory
          .setOffset(long) // required offset
          .setSize(long) // required size
          .build();
       
      Returns:
      A new VMAAllocationInfo builder