Class VmaBudget
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.util.vma.VmaBudget
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
public class VmaBudget extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResourceStatistics of current memory usage and available budget, in bytes, for specific memory heap.Layout
struct VmaBudget { VkDeviceSizeblockBytes(); VkDeviceSizeallocationBytes(); VkDeviceSizeusage(); VkDeviceSizebudget(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVmaBudget.BufferAn array ofVmaBudgetstructs.
-
Field Summary
Fields Modifier and Type Field Description static intALIGNOFThe struct alignment in bytes.static intALLOCATIONBYTES
BLOCKBYTES
BUDGETThe struct member offsets.static intSIZEOFThe struct size in bytes.static intUSAGEThe struct member offsets.
-
Constructor Summary
Constructors Constructor Description VmaBudget(java.nio.ByteBuffer container)Creates aVmaBudgetinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longallocationBytes()Sum size of all allocations created in particular heap, in bytes.longblockBytes()Sum size of allVkDeviceMemoryblocks allocated from particular heap, in bytes.longbudget()Estimated amount of memory available to the program, in bytes.static VmaBudgetcalloc()Returns a newVmaBudgetinstance allocated withmemCalloc.static VmaBudget.Buffercalloc(int capacity)Returns a newVmaBudget.Bufferinstance allocated withmemCalloc.static VmaBudget.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newVmaBudget.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VmaBudgetcalloc(org.lwjgl.system.MemoryStack stack)Returns a newVmaBudgetinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VmaBudgetcreate()Returns a newVmaBudgetinstance allocated withBufferUtils.static VmaBudget.Buffercreate(int capacity)Returns a newVmaBudget.Bufferinstance allocated withBufferUtils.static VmaBudgetcreate(long address)Returns a newVmaBudgetinstance for the specified memory address.static VmaBudget.Buffercreate(long address, int capacity)Create aVmaBudget.Bufferinstance at the specified memory.static VmaBudgetcreateSafe(long address)static VmaBudget.BuffercreateSafe(long address, int capacity)static VmaBudgetmalloc()Returns a newVmaBudgetinstance allocated withmemAlloc.static VmaBudget.Buffermalloc(int capacity)Returns a newVmaBudget.Bufferinstance allocated withmemAlloc.static VmaBudget.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newVmaBudget.Bufferinstance allocated on the specifiedMemoryStack.static VmaBudgetmalloc(org.lwjgl.system.MemoryStack stack)Returns a newVmaBudgetinstance allocated on the specifiedMemoryStack.static longnallocationBytes(long struct)Unsafe version ofallocationBytes().static longnblockBytes(long struct)Unsafe version ofblockBytes().static longnbudget(long struct)Unsafe version ofbudget().static longnusage(long struct)Unsafe version ofusage().intsizeof()longusage()Estimated current memory usage of the program, in bytes.
-
-
-
Constructor Detail
-
VmaBudget
public VmaBudget(java.nio.ByteBuffer container)
Creates aVmaBudgetinstance at the current position of the specifiedByteBuffercontainer. 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
-
sizeof
public int sizeof()
- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
blockBytes
public long blockBytes()
Sum size of allVkDeviceMemoryblocks allocated from particular heap, in bytes.
-
allocationBytes
public long allocationBytes()
Sum size of all allocations created in particular heap, in bytes.Usually less or equal than
blockBytes. DifferenceblockBytes - allocationBytesis the amount of memory allocated but unused - available for new allocations or wasted due to fragmentation.
-
usage
public long usage()
Estimated current memory usage of the program, in bytes.Fetched from system using
VK_EXT_memory_budgetextension 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, orVkDeviceMemoryblocks 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_budgetextension 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. Differencebudget - usageis 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 newVmaBudgetinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static VmaBudget calloc()
Returns a newVmaBudgetinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static VmaBudget create()
Returns a newVmaBudgetinstance allocated withBufferUtils.
-
create
public static VmaBudget create(long address)
Returns a newVmaBudgetinstance for the specified memory address.
-
createSafe
@Nullable public static VmaBudget createSafe(long address)
-
malloc
public static VmaBudget.Buffer malloc(int capacity)
Returns a newVmaBudget.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static VmaBudget.Buffer calloc(int capacity)
Returns a newVmaBudget.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static VmaBudget.Buffer create(int capacity)
Returns a newVmaBudget.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static VmaBudget.Buffer create(long address, int capacity)
Create aVmaBudget.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
@Nullable public static VmaBudget.Buffer createSafe(long address, int capacity)
-
malloc
public static VmaBudget malloc(org.lwjgl.system.MemoryStack stack)
Returns a newVmaBudgetinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
public static VmaBudget calloc(org.lwjgl.system.MemoryStack stack)
Returns a newVmaBudgetinstance allocated on the specifiedMemoryStackand 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 newVmaBudget.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
calloc
public static VmaBudget.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVmaBudget.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
nblockBytes
public static long nblockBytes(long struct)
Unsafe version ofblockBytes().
-
nallocationBytes
public static long nallocationBytes(long struct)
Unsafe version ofallocationBytes().
-
nusage
public static long nusage(long struct)
Unsafe version ofusage().
-
nbudget
public static long nbudget(long struct)
Unsafe version ofbudget().
-
-