Skip to content

VulkanFrameAllocator

final class VulkanFrameAllocator
Package: dev.joid.backend.vulkan.render.buffer · Module: backend-vulkan · Source: VulkanFrameAllocator.java
Backends: Vulkan

Hands out aligned ranges of one buffer for the vertices or the uniforms of a frame, reset when the slot of the frame comes back.

ReturnsSignatureSummary
VulkanFrameAllocator(VulkanContext context, long capacity, int usage, long alignment, Consumer disposer)Creates the allocator with a buffer of that capacity in bytes, that usage and that alignment; the consumer defers the destruction of a buffer that grew.

ReturnsSignatureSummary
voiddestroy()Destroys the current buffer.
longallocate(long size)Returns the offset of an aligned range of that size in the current buffer.
voidreset()Makes the whole buffer free again, at the start of a frame of its slot.
intgetUsage()Returns the usage of the buffers.
longgetAlignment()Returns the alignment of the offsets, in bytes.
VulkanContextgetContext()Returns the device context.
Consumer<Runnable>getDisposer()Returns the consumer that defers the destruction of a replaced buffer.
longgetOffset()Returns the first free byte of the current buffer.
VulkanBuffergetBuffer()Returns the current buffer.

VulkanFrameAllocator(VulkanContext context, long capacity, int usage, long alignment, Consumer<Runnable> disposer)

Creates the allocator with a buffer of that capacity in bytes, that usage and that alignment; the consumer defers the destruction of a buffer that grew.

void destroy()

Destroys the current buffer.

long allocate(long size)

Returns the offset of an aligned range of that size in the current buffer. When the buffer is full, it replaces it with a buffer twice as large, defers the destruction of the old one, and returns 0.

void reset()

Makes the whole buffer free again, at the start of a frame of its slot.

int getUsage()

Returns the usage of the buffers.

long getAlignment()

Returns the alignment of the offsets, in bytes.

VulkanContext getContext()

Returns the device context.

Consumer<Runnable> getDisposer()

Returns the consumer that defers the destruction of a replaced buffer.

long getOffset()

Returns the first free byte of the current buffer.

VulkanBuffer getBuffer()

Returns the current buffer.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page