Class VmaBudget

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

public class VmaBudget extends org.lwjgl.system.Struct<VmaBudget> implements org.lwjgl.system.NativeResource
Statistics of current memory usage and available budget for a specific memory heap.

These are fast to calculate.

Layout


 struct VmaBudget {
     VmaStatistics statistics();
     VkDeviceSize usage();
     VkDeviceSize budget();
 }
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An array of VmaBudget 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 size in bytes.
    static final int
    The struct member offsets.
    static final int
    The struct member offsets.

    Fields inherited from interface org.lwjgl.system.Pointer

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

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

    Modifier and Type
    Method
    Description
    long
    Estimated amount of memory available to the program, in bytes.
    static VmaBudget
    Returns a new VmaBudget instance allocated with memCalloc.
    calloc(int capacity)
    Returns a new VmaBudget.Buffer instance allocated with memCalloc.
    calloc(int capacity, org.lwjgl.system.MemoryStack stack)
    Returns a new VmaBudget.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
    static VmaBudget
    calloc(org.lwjgl.system.MemoryStack stack)
    Returns a new VmaBudget instance allocated on the specified MemoryStack and initializes all its bits to zero.
    static VmaBudget
    Returns a new VmaBudget instance allocated with BufferUtils.
    create(int capacity)
    Returns a new VmaBudget.Buffer instance allocated with BufferUtils.
    static VmaBudget
    create(long address)
    Returns a new VmaBudget instance for the specified memory address.
    create(long address, int capacity)
    Create a VmaBudget.Buffer instance at the specified memory.
    static @Nullable VmaBudget
    createSafe(long address)
    Like create, but returns null if address is NULL.
    static @Nullable VmaBudget.Buffer
    createSafe(long address, int capacity)
    Like create, but returns null if address is NULL.
    static VmaBudget
    Returns a new VmaBudget instance allocated with memAlloc.
    malloc(int capacity)
    Returns a new VmaBudget.Buffer instance allocated with memAlloc.
    malloc(int capacity, org.lwjgl.system.MemoryStack stack)
    Returns a new VmaBudget.Buffer instance allocated on the specified MemoryStack.
    static VmaBudget
    malloc(org.lwjgl.system.MemoryStack stack)
    Returns a new VmaBudget instance allocated on the specified MemoryStack.
    static long
    nbudget(long struct)
    Unsafe version of budget().
    nstatistics(long struct)
    Unsafe version of statistics().
    static long
    nusage(long struct)
    Unsafe version of usage().
    int
     
    statistics fetched from the library
    long
    Estimated current memory usage of the program, in bytes.

    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.
    • STATISTICS

      public static final int STATISTICS
      The struct member offsets.
    • USAGE

      public static final int USAGE
      The struct member offsets.
    • BUDGET

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

    • VmaBudget

      public VmaBudget(ByteBuffer container)
      Creates a VmaBudget 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<VmaBudget>
    • statistics

      public VmaStatistics statistics()
      statistics fetched from the library
    • usage

      public long usage()
      Estimated current memory usage of the program, in bytes.

      Fetched from system using VK_EXT_memory_budget extension if enabled.

      It might be different than statistics.blockBytes (usually higher) due to additional implicit objects also occupying the memory, like swapchain, pipelines, descriptor heaps, command buffers, or VkDeviceMemory blocks allocated outside of this library, if any.

    • budget

      public long budget()
      Estimated amount of memory available to the program, in bytes.

      Fetched from system using VK_EXT_memory_budget extension if enabled.

      It might be different (most probably smaller) than VkMemoryHeap::size[heapIndex] due to factors external to the program, decided by the operating system. Difference budget - usage is the amount of additional memory that can probably be allocated without problems. Exceeding the budget may result in various problems.

    • malloc

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static VmaBudget.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VmaBudget.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
    • nstatistics

      public static VmaStatistics nstatistics(long struct)
      Unsafe version of statistics().
    • nusage

      public static long nusage(long struct)
      Unsafe version of usage().
    • nbudget

      public static long nbudget(long struct)
      Unsafe version of budget().