public class VmaBudget
extends org.lwjgl.system.Struct
implements org.lwjgl.system.NativeResource
blockBytes – Sum size of all VkDeviceMemory blocks allocated from particular heap, in bytes.allocationBytes –
Sum size of all allocations created in particular heap, in bytes.
Usually less or equal than blockBytes. Difference blockBytes - allocationBytes is the amount of memory allocated but unused - available
for new allocations or wasted due to fragmentation.
It might be greater than blockBytes if there are some allocations in lost state, as they account to this value as well.
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 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 –
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, like other programs
also consuming system resources. Difference budget - usage is the amount of additional memory that can probably be allocated without problems.
Exceeding the budget may result in various problems.
struct VmaBudget {
VkDeviceSize blockBytes;
VkDeviceSize allocationBytes;
VkDeviceSize usage;
VkDeviceSize budget;
}| Modifier and Type | Class and Description |
|---|---|
static class |
VmaBudget.Buffer
An array of
VmaBudget structs. |
| Modifier and Type | Field and Description |
|---|---|
static int |
ALIGNOF
The struct alignment in bytes.
|
static int |
ALLOCATIONBYTES
The struct member offsets.
|
static int |
BLOCKBYTES
The struct member offsets.
|
static int |
BUDGET
The struct member offsets.
|
static int |
SIZEOF
The struct size in bytes.
|
static int |
USAGE
The struct member offsets.
|
| Constructor and Description |
|---|
VmaBudget(java.nio.ByteBuffer container)
Creates a
VmaBudget instance at the current position of the specified ByteBuffer container. |
| Modifier and Type | Method and Description |
|---|---|
long |
allocationBytes()
Returns the value of the
allocationBytes field. |
long |
blockBytes()
Returns the value of the
blockBytes field. |
long |
budget()
Returns the value of the
budget field. |
static VmaBudget |
calloc()
Returns a new
VmaBudget instance allocated with memCalloc. |
static VmaBudget.Buffer |
calloc(int capacity)
Returns a new
VmaBudget.Buffer instance allocated with memCalloc. |
static VmaBudget |
callocStack()
Returns a new
VmaBudget instance allocated on the thread-local MemoryStack and initializes all its bits to zero. |
static VmaBudget.Buffer |
callocStack(int capacity)
Returns a new
VmaBudget.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero. |
static VmaBudget.Buffer |
callocStack(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 |
callocStack(org.lwjgl.system.MemoryStack stack)
Returns a new
VmaBudget instance allocated on the specified MemoryStack and initializes all its bits to zero. |
static VmaBudget |
create()
Returns a new
VmaBudget instance allocated with BufferUtils. |
static VmaBudget.Buffer |
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. |
static VmaBudget.Buffer |
create(long address,
int capacity)
Create a
VmaBudget.Buffer instance at the specified memory. |
static VmaBudget |
createSafe(long address)
|
static VmaBudget.Buffer |
createSafe(long address,
int capacity)
|
static VmaBudget |
malloc()
Returns a new
VmaBudget instance allocated with memAlloc. |
static VmaBudget.Buffer |
malloc(int capacity)
Returns a new
VmaBudget.Buffer instance allocated with memAlloc. |
static VmaBudget |
mallocStack()
Returns a new
VmaBudget instance allocated on the thread-local MemoryStack. |
static VmaBudget.Buffer |
mallocStack(int capacity)
Returns a new
VmaBudget.Buffer instance allocated on the thread-local MemoryStack. |
static VmaBudget.Buffer |
mallocStack(int capacity,
org.lwjgl.system.MemoryStack stack)
Returns a new
VmaBudget.Buffer instance allocated on the specified MemoryStack. |
static VmaBudget |
mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a new
VmaBudget instance allocated on the specified MemoryStack. |
static long |
nallocationBytes(long struct)
Unsafe version of
allocationBytes(). |
static long |
nblockBytes(long struct)
Unsafe version of
blockBytes(). |
static long |
nbudget(long struct)
Unsafe version of
budget(). |
static long |
nusage(long struct)
Unsafe version of
usage(). |
int |
sizeof() |
long |
usage()
Returns the value of the
usage field. |
public static final int SIZEOF
public static final int ALIGNOF
public static final int BLOCKBYTES
public static final int ALLOCATIONBYTES
public static final int USAGE
public static final int BUDGET
public VmaBudget(java.nio.ByteBuffer container)
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.
public int sizeof()
sizeof in class org.lwjgl.system.Structpublic long blockBytes()
blockBytes field.public long allocationBytes()
allocationBytes field.public long usage()
usage field.public long budget()
budget field.public static VmaBudget malloc()
VmaBudget instance allocated with memAlloc. The instance must be explicitly freed.public static VmaBudget calloc()
VmaBudget instance allocated with memCalloc. The instance must be explicitly freed.public static VmaBudget create()
VmaBudget instance allocated with BufferUtils.public static VmaBudget create(long address)
VmaBudget instance for the specified memory address.@Nullable public static VmaBudget createSafe(long address)
public static VmaBudget.Buffer malloc(int capacity)
VmaBudget.Buffer instance allocated with memAlloc. The instance must be explicitly freed.capacity - the buffer capacitypublic static VmaBudget.Buffer calloc(int capacity)
VmaBudget.Buffer instance allocated with memCalloc. The instance must be explicitly freed.capacity - the buffer capacitypublic static VmaBudget.Buffer create(int capacity)
VmaBudget.Buffer instance allocated with BufferUtils.capacity - the buffer capacitypublic static VmaBudget.Buffer create(long address, int capacity)
VmaBudget.Buffer instance at the specified memory.address - the memory addresscapacity - the buffer capacity@Nullable public static VmaBudget.Buffer createSafe(long address, int capacity)
public static VmaBudget mallocStack()
VmaBudget instance allocated on the thread-local MemoryStack.public static VmaBudget callocStack()
VmaBudget instance allocated on the thread-local MemoryStack and initializes all its bits to zero.public static VmaBudget mallocStack(org.lwjgl.system.MemoryStack stack)
VmaBudget instance allocated on the specified MemoryStack.stack - the stack from which to allocatepublic static VmaBudget callocStack(org.lwjgl.system.MemoryStack stack)
VmaBudget instance allocated on the specified MemoryStack and initializes all its bits to zero.stack - the stack from which to allocatepublic static VmaBudget.Buffer mallocStack(int capacity)
VmaBudget.Buffer instance allocated on the thread-local MemoryStack.capacity - the buffer capacitypublic static VmaBudget.Buffer callocStack(int capacity)
VmaBudget.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.capacity - the buffer capacitypublic static VmaBudget.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
VmaBudget.Buffer instance allocated on the specified MemoryStack.stack - the stack from which to allocatecapacity - the buffer capacitypublic static VmaBudget.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
VmaBudget.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.stack - the stack from which to allocatecapacity - the buffer capacitypublic static long nblockBytes(long struct)
blockBytes().public static long nallocationBytes(long struct)
allocationBytes().public static long nusage(long struct)
usage().public static long nbudget(long struct)
budget().Copyright LWJGL. All Rights Reserved. License terms.