Record Class VmaStatistics

java.lang.Object
java.lang.Record
club.doki7.vma.datatype.VmaStatistics
All Implemented Interfaces:
IPointer, IVmaStatistics

@ValueBasedCandidate @UnsafeConstructor public record VmaStatistics(@NotNull MemorySegment segment) extends Record implements IVmaStatistics

Calculated statistics of memory usage e.g. in a specific memory type, heap, custom pool, or total.

These are fast to calculate. See functions: vmaGetHeapBudgets(), vmaGetPoolStatistics().

Structure

typedef struct VmaStatistics {
    uint32_t blockCount;
    uint32_t allocationCount;
    VkDeviceSize blockBytes;
    VkDeviceSize allocationBytes;
} VmaStatistics;

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

  • blockCount() Number of `VkDeviceMemory` objects - Vulkan memory blocks allocated.
  • allocationCount() Number of VmaAllocation objects allocated.

    Dedicated allocations have their own blocks, so each one adds 1 to allocationCount as well as blockCount.

  • blockBytes() Number of bytes allocated in `VkDeviceMemory` blocks.

    ote To avoid confusion, please be aware that what Vulkan calls an "allocation" - a whole VkDeviceMemory object (e.g. as in VkPhysicalDeviceLimits::maxMemoryAllocationCount) is called a "block" in VMA, while VMA calls "allocation" a VmaAllocation object that represents a memory region sub-allocated from such block, usually for a single buffer or image.

  • allocationBytes() Total number of bytes occupied by all VmaAllocation objects.

    Always less or equal than blockBytes. Difference (blockBytes - allocationBytes) is the amount of memory allocated from Vulkan but unused by any VmaAllocation.

  • Field Details

    • LAYOUT

      public static final StructLayout LAYOUT
    • BYTES

      public static final long BYTES
    • PATH$blockCount

      public static final MemoryLayout.PathElement PATH$blockCount
    • PATH$allocationCount

      public static final MemoryLayout.PathElement PATH$allocationCount
    • PATH$blockBytes

      public static final MemoryLayout.PathElement PATH$blockBytes
    • PATH$allocationBytes

      public static final MemoryLayout.PathElement PATH$allocationBytes
    • LAYOUT$blockCount

      public static final ValueLayout.OfInt LAYOUT$blockCount
    • LAYOUT$allocationCount

      public static final ValueLayout.OfInt LAYOUT$allocationCount
    • LAYOUT$blockBytes

      public static final ValueLayout.OfLong LAYOUT$blockBytes
    • LAYOUT$allocationBytes

      public static final ValueLayout.OfLong LAYOUT$allocationBytes
    • SIZE$blockCount

      public static final long SIZE$blockCount
    • SIZE$allocationCount

      public static final long SIZE$allocationCount
    • SIZE$blockBytes

      public static final long SIZE$blockBytes
    • SIZE$allocationBytes

      public static final long SIZE$allocationBytes
    • OFFSET$blockCount

      public static final long OFFSET$blockCount
    • OFFSET$allocationCount

      public static final long OFFSET$allocationCount
    • OFFSET$blockBytes

      public static final long OFFSET$blockBytes
    • OFFSET$allocationBytes

      public static final long OFFSET$allocationBytes
  • Constructor Details

    • VmaStatistics

      public VmaStatistics(@NotNull @NotNull MemorySegment segment)
      Creates an instance of a VmaStatistics record class.
      Parameters:
      segment - the value for the segment record component
  • Method Details

    • allocate

      public static VmaStatistics allocate(Arena arena)
    • allocate

      public static VmaStatistics.Ptr allocate(Arena arena, long count)
    • clone

      public static VmaStatistics clone(Arena arena, VmaStatistics src)
    • blockCount

      @Unsigned public int blockCount()
    • blockCount

      public VmaStatistics blockCount(@Unsigned int value)
    • allocationCount

      @Unsigned public int allocationCount()
    • allocationCount

      public VmaStatistics allocationCount(@Unsigned int value)
    • blockBytes

      @NativeType("VkDeviceSize") @Unsigned public long blockBytes()
    • blockBytes

      public VmaStatistics blockBytes(@NativeType("VkDeviceSize") @Unsigned long value)
    • allocationBytes

      @NativeType("VkDeviceSize") @Unsigned public long allocationBytes()
    • allocationBytes

      public VmaStatistics allocationBytes(@NativeType("VkDeviceSize") @Unsigned long value)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • segment

      @NotNull public @NotNull MemorySegment segment()
      Returns the value of the segment record component.
      Specified by:
      segment in interface IPointer
      Returns:
      the value of the segment record component