Top Description Inners Fields Constructors Methods
org.lwjgl.util.vma

public Class VmaBudget

extends Struct<VmaBudget>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

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
Vma#vmaGetHeapBudgets

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
VmaBudget.Buffer

An array of VmaBudget structs.

Field Summary

Modifier and TypeField and Description
public static final int
ALIGNOF

The struct alignment in bytes.

public static final int
BUDGET

The struct member offsets.

public static final int
SIZEOF

The struct size in bytes.

public static final int
STATISTICS

The struct member offsets.

public static final int
USAGE

The struct member offsets.

Inherited from org.lwjgl.system.Struct:
containerDEFAULT_ALIGN_ASDEFAULT_PACK_ALIGNMENT

Constructor Summary

AccessConstructor and Description
protected
VmaBudget(long address, ByteBuffer container)

public
VmaBudget(ByteBuffer container)

Creates a VmaBudget instance at the current position of the specified ByteBuffer container.

Method Summary

Modifier and TypeMethod and Description
public long
budget()

Estimated amount of memory available to the program, in bytes.

public static VmaBudget
calloc()

Returns a new VmaBudget instance allocated with memCalloc.

public static VmaBudget.Buffer
calloc(int
the buffer capacity
capacity
)

Returns a new VmaBudget.Buffer instance allocated with memCalloc.

public static VmaBudget
calloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new VmaBudget instance allocated on the specified MemoryStack and initializes all its bits to zero.

public static VmaBudget.Buffer
calloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new VmaBudget.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

protected VmaBudget
create(long
the struct memory address
address
,
ByteBuffer
an optional container buffer, to be referenced strongly by the struct instance.
container
)

Implements abstract org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.
public static VmaBudget
create()

Returns a new VmaBudget instance allocated with BufferUtils.

public static VmaBudget
create(long address)

Returns a new VmaBudget instance for the specified memory address.

public static VmaBudget.Buffer
create(int
the buffer capacity
capacity
)

Returns a new VmaBudget.Buffer instance allocated with BufferUtils.

public static VmaBudget.Buffer
create(long
the memory address
address
,
int
the buffer capacity
capacity
)

Create a VmaBudget.Buffer instance at the specified memory.

public static VmaBudget
createSafe(long address)

Like create, but returns null if address is NULL.

public static VmaBudget.Buffer
createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

public static VmaBudget
malloc()

Returns a new VmaBudget instance allocated with memAlloc.

public static VmaBudget.Buffer
malloc(int
the buffer capacity
capacity
)

Returns a new VmaBudget.Buffer instance allocated with memAlloc.

public static VmaBudget
malloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new VmaBudget instance allocated on the specified MemoryStack.

public static VmaBudget.Buffer
malloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new VmaBudget.Buffer instance allocated on the specified MemoryStack.

public static long
nbudget(long struct)

Unsafe version of budget.

public static VmaStatistics
nstatistics(long struct)

Unsafe version of statistics.

public static long
nusage(long struct)

Unsafe version of usage.

public int
sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).
public VmaStatistics
statistics()

statistics fetched from the library

public long
usage()

Estimated current memory usage of the program, in bytes.

Inherited from org.lwjgl.system.Struct:
__array__array__array__checkContainer__checkMalloc__create__getContainer__getContainer__member__member__member__padding__padding__struct__struct__union__unionclearfreeisNullvalidate

Field Detail

ALIGNOFback to summary
public static final int ALIGNOF

The struct alignment in bytes.

BUDGETback to summary
public static final int BUDGET

The struct member offsets.

SIZEOFback to summary
public static final int SIZEOF

The struct size in bytes.

STATISTICSback to summary
public static final int STATISTICS

The struct member offsets.

USAGEback to summary
public static final int USAGE

The struct member offsets.

Constructor Detail

VmaBudgetback to summary
protected VmaBudget(long address, ByteBuffer container)
VmaBudgetback to summary
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 Detail

budgetback to summary
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.

Annotations
@NativeType:VkDeviceSize
callocback to summary
public static VmaBudget calloc()

Returns a new VmaBudget instance allocated with memCalloc. The instance must be explicitly freed.

callocback to summary
public static VmaBudget.Buffer calloc(int capacity)

Returns a new VmaBudget.Buffer instance allocated with memCalloc. The instance must be explicitly freed.

Parameters
capacity:int

the buffer capacity

callocback to summary
public static VmaBudget calloc(MemoryStack stack)

Returns a new VmaBudget instance allocated on the specified MemoryStack and initializes all its bits to zero.

Parameters
stack:MemoryStack

the stack from which to allocate

callocback to summary
public static VmaBudget.Buffer calloc(int capacity, MemoryStack stack)

Returns a new VmaBudget.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

Parameters
capacity:int

the buffer capacity

stack:MemoryStack

the stack from which to allocate

createback to summary
protected VmaBudget create(long address, ByteBuffer container)

Implements abstract org.lwjgl.system.Struct.create.

Doc from org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.

Effectively, every Struct instance is a factory for more instances of the same type. This is used by StructBuffer.

Parameters
address:long

the struct memory address

container:ByteBuffer

an optional container buffer, to be referenced strongly by the struct instance.

Annotations
@Override
createback to summary
public static VmaBudget create()

Returns a new VmaBudget instance allocated with BufferUtils.

createback to summary
public static VmaBudget create(long address)

Returns a new VmaBudget instance for the specified memory address.

createback to summary
public static VmaBudget.Buffer create(int capacity)

Returns a new VmaBudget.Buffer instance allocated with BufferUtils.

Parameters
capacity:int

the buffer capacity

createback to summary
public static VmaBudget.Buffer create(long address, int capacity)

Create a VmaBudget.Buffer instance at the specified memory.

Parameters
address:long

the memory address

capacity:int

the buffer capacity

createSafeback to summary
public static VmaBudget createSafe(long address)

Like create, but returns null if address is NULL.

Annotations
@Nullable
createSafeback to summary
public static VmaBudget.Buffer createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

Annotations
@Nullable
mallocback to summary
public static VmaBudget malloc()

Returns a new VmaBudget instance allocated with memAlloc. The instance must be explicitly freed.

mallocback to summary
public static VmaBudget.Buffer malloc(int capacity)

Returns a new VmaBudget.Buffer instance allocated with memAlloc. The instance must be explicitly freed.

Parameters
capacity:int

the buffer capacity

mallocback to summary
public static VmaBudget malloc(MemoryStack stack)

Returns a new VmaBudget instance allocated on the specified MemoryStack.

Parameters
stack:MemoryStack

the stack from which to allocate

mallocback to summary
public static VmaBudget.Buffer malloc(int capacity, MemoryStack stack)

Returns a new VmaBudget.Buffer instance allocated on the specified MemoryStack.

Parameters
capacity:int

the buffer capacity

stack:MemoryStack

the stack from which to allocate

nbudgetback to summary
public static long nbudget(long struct)

Unsafe version of budget.

nstatisticsback to summary
public static VmaStatistics nstatistics(long struct)

Unsafe version of statistics.

nusageback to summary
public static long nusage(long struct)

Unsafe version of usage.

sizeofback to summary
public int sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Doc from org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).

Annotations
@Override
statisticsback to summary
public VmaStatistics statistics()

statistics fetched from the library

usageback to summary
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.

Annotations
@NativeType:VkDeviceSize
org.lwjgl.util.vma back to summary

public Class VmaBudget.Buffer

extends StructBuffer<VmaBudget, VmaBudget.Buffer>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable

An array of VmaBudget structs.

Field Summary

Modifier and TypeField and Description
private static final VmaBudget

Constructor Summary

AccessConstructor and Description
public
Buffer(ByteBuffer container)

Creates a new VmaBudget.Buffer instance backed by the specified container.

public
Buffer(long address, int cap)

pack-priv
Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap)

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the value of the VmaBudget#budget field.
budget
()

protected VmaBudget
protected VmaBudget.Buffer
public VmaStatistics

Returns:

a VmaStatistics view of the VmaBudget#statistics field.
statistics
()

public long

Returns:

the value of the VmaBudget#usage field.
usage
()

Inherited from org.lwjgl.system.StructBuffer:
applyapplyforEachgetgetgetgetiteratorparallelStreamputputsizeofspliteratorstream

Field Detail

ELEMENT_FACTORYback to summary
private static final VmaBudget ELEMENT_FACTORY

Constructor Detail

Bufferback to summary
public Buffer(ByteBuffer container)

Creates a new VmaBudget.Buffer instance backed by the specified container.

Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by VmaBudget#SIZEOF, and its mark will be undefined.

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

Bufferback to summary
public Buffer(long address, int cap)
Bufferback to summary
pack-priv Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap)

Method Detail

budgetback to summary
public long budget()
Returns:long

the value of the VmaBudget#budget field.

Annotations
@NativeType:VkDeviceSize
getElementFactoryback to summary
protected VmaBudget getElementFactory()

Implements abstract org.lwjgl.system.StructBuffer.getElementFactory.

Annotations
@Override
selfback to summary
protected VmaBudget.Buffer self()

Implements abstract org.lwjgl.system.CustomBuffer.self.

Annotations
@Override
statisticsback to summary
public VmaStatistics statistics()
Returns:VmaStatistics

a VmaStatistics view of the VmaBudget#statistics field.

usageback to summary
public long usage()
Returns:long

the value of the VmaBudget#usage field.

Annotations
@NativeType:VkDeviceSize