Class VmaStatistics

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<VmaStatistics>
org.lwjgl.util.vma.VmaStatistics
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class VmaStatistics extends org.lwjgl.system.Struct<VmaStatistics> implements org.lwjgl.system.NativeResource
Calculated statistics of memory usage e.g. in a specific memory type, heap, custom pool, or total.

These are fast to calculate.

Layout


 struct VmaStatistics {
     uint32_t blockCount();
     uint32_t allocationCount();
     VkDeviceSize blockBytes();
     VkDeviceSize allocationBytes();
 }
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An array of VmaStatistics structs.

    Nested classes/interfaces inherited from class org.lwjgl.system.Struct

    org.lwjgl.system.Struct.StructValidation

    Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer

    org.lwjgl.system.Pointer.Default
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The struct alignment in bytes.
    static final int
    The struct member offsets.
    static final int
    The struct member offsets.
    static final int
    The struct member offsets.
    static final int
    The struct member offsets.
    static final int
    The struct size in bytes.

    Fields inherited from interface org.lwjgl.system.Pointer

    BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a VmaStatistics instance at the current position of the specified ByteBuffer container.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    total number of bytes occupied by all VmaAllocation objects.
    int
    number of VmaAllocation objects allocated.
    long
    number of bytes allocated in VkDeviceMemory blocks.
    int
    number of VkDeviceMemory objects - Vulkan memory blocks allocated
    Returns a new VmaStatistics instance allocated with memCalloc.
    calloc(int capacity)
    Returns a new VmaStatistics.Buffer instance allocated with memCalloc.
    calloc(int capacity, org.lwjgl.system.MemoryStack stack)
    Returns a new VmaStatistics.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
    calloc(org.lwjgl.system.MemoryStack stack)
    Returns a new VmaStatistics instance allocated on the specified MemoryStack and initializes all its bits to zero.
    Returns a new VmaStatistics instance allocated with BufferUtils.
    create(int capacity)
    Returns a new VmaStatistics.Buffer instance allocated with BufferUtils.
    create(long address)
    Returns a new VmaStatistics instance for the specified memory address.
    create(long address, int capacity)
    Create a VmaStatistics.Buffer instance at the specified memory.
    static @Nullable VmaStatistics
    createSafe(long address)
    Like create, but returns null if address is NULL.
    static @Nullable VmaStatistics.Buffer
    createSafe(long address, int capacity)
    Like create, but returns null if address is NULL.
    Returns a new VmaStatistics instance allocated with memAlloc.
    malloc(int capacity)
    Returns a new VmaStatistics.Buffer instance allocated with memAlloc.
    malloc(int capacity, org.lwjgl.system.MemoryStack stack)
    Returns a new VmaStatistics.Buffer instance allocated on the specified MemoryStack.
    malloc(org.lwjgl.system.MemoryStack stack)
    Returns a new VmaStatistics instance allocated on the specified MemoryStack.
    static long
    nallocationBytes(long struct)
    Unsafe version of allocationBytes().
    static int
    nallocationCount(long struct)
    Unsafe version of allocationCount().
    static long
    nblockBytes(long struct)
    Unsafe version of blockBytes().
    static int
    nblockCount(long struct)
    Unsafe version of blockCount().
    int
     

    Methods inherited from class org.lwjgl.system.Struct

    clear, free, isNull, validate, validate

    Methods inherited from class org.lwjgl.system.Pointer.Default

    address, equals, hashCode, toString

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.lwjgl.system.NativeResource

    close, free
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • BLOCKCOUNT

      public static final int BLOCKCOUNT
      The struct member offsets.
    • ALLOCATIONCOUNT

      public static final int ALLOCATIONCOUNT
      The struct member offsets.
    • BLOCKBYTES

      public static final int BLOCKBYTES
      The struct member offsets.
    • ALLOCATIONBYTES

      public static final int ALLOCATIONBYTES
      The struct member offsets.
  • Constructor Details

    • VmaStatistics

      public VmaStatistics(ByteBuffer container)
      Creates a VmaStatistics instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<VmaStatistics>
    • blockCount

      public int blockCount()
      number of VkDeviceMemory objects - Vulkan memory blocks allocated
    • allocationCount

      public int allocationCount()
      number of VmaAllocation objects allocated.

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

    • blockBytes

      public long blockBytes()
      number of bytes allocated in VkDeviceMemory blocks.

      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

      public long 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.

    • malloc

      public static VmaStatistics malloc()
      Returns a new VmaStatistics instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static VmaStatistics calloc()
      Returns a new VmaStatistics instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static VmaStatistics create()
      Returns a new VmaStatistics instance allocated with BufferUtils.
    • create

      public static VmaStatistics create(long address)
      Returns a new VmaStatistics instance for the specified memory address.
    • createSafe

      public static @Nullable VmaStatistics createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static VmaStatistics.Buffer malloc(int capacity)
      Returns a new VmaStatistics.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static VmaStatistics.Buffer calloc(int capacity)
      Returns a new VmaStatistics.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VmaStatistics.Buffer create(int capacity)
      Returns a new VmaStatistics.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VmaStatistics.Buffer create(long address, int capacity)
      Create a VmaStatistics.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable VmaStatistics.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static VmaStatistics malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new VmaStatistics instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static VmaStatistics calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new VmaStatistics instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static VmaStatistics.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VmaStatistics.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static VmaStatistics.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VmaStatistics.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nblockCount

      public static int nblockCount(long struct)
      Unsafe version of blockCount().
    • nallocationCount

      public static int nallocationCount(long struct)
      Unsafe version of allocationCount().
    • nblockBytes

      public static long nblockBytes(long struct)
      Unsafe version of blockBytes().
    • nallocationBytes

      public static long nallocationBytes(long struct)
      Unsafe version of allocationBytes().