Skip to content

FrameBufferPool

final class FrameBufferPool
Package: dev.joid.lib.render.framebuffer · Module: core · Source: FrameBufferPool.java

Lends offscreen framebuffers by owner and nesting depth, grows them when a draw does not fit, and frees the ones left unused.

The effects, the shader passes and DrawRaster borrow their framebuffers here, so that a size that changes on every frame does not create one each time. A framebuffer grows to the next power of two of the size asked, and is freed after 5 seconds without use, or when no draw of the last 5 seconds needed its full size: the next draw creates it again at the size it needs. Each draw of a UI bridge calls releaseUnused(), so a host that draws through the UI bridge has nothing to call.

ReturnsSignatureSummary
IFrameBuffer[]allocate(Object owner, int depth, int count, int width, int height) staticReturns count framebuffers of at least width × height pixels for owner at nesting depth depth, the same ones as last time when they are large enough.
voidcleanup() staticFrees every pooled framebuffer, for example before the render bridge is destroyed.
voidreleaseUnused() staticFrees the framebuffers that no allocate asked for in the last 5 seconds, and those larger than the power of two that the largest allocate of the last 5 seconds needed.

IFrameBuffer[] allocate(Object owner, int depth, int count, int width, int height) static

Returns count framebuffers of at least width × height pixels for owner at nesting depth depth, the same ones as last time when they are large enough. Use one depth per level of nesting, so that a draw inside a draw gets its own framebuffers.

void cleanup() static

Frees every pooled framebuffer, for example before the render bridge is destroyed.

void releaseUnused() static

Frees the framebuffers that no allocate asked for in the last 5 seconds, and those larger than the power of two that the largest allocate of the last 5 seconds needed.


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