Documentation / scene / RGTextureAllocator
Interface: RGTextureAllocator<TTexture, TFramebuffer>
Defined in: libs/scene/src/render/rendergraph/types.ts:499
Interface for allocating and releasing transient textures.
Implement this to bridge the render graph with your GPU device's resource pool. The executor calls allocate() before a resource's first use and release() after its last use.
Lifetime contract: the graph compiler extends a texture's lifetime to cover every graph-managed framebuffer it is attached to, and the executor releases framebuffers before textures at the same pass boundary. Allocators may therefore assume releaseFramebuffer() is called before release() of its attachments, and must keep a released framebuffer's attachments intact until their own release() call.
Type Parameters
TTexture
TTexture = unknown
The concrete texture type (e.g. Texture2D).
TFramebuffer
TFramebuffer = unknown
Methods
allocate()
allocate(
desc,size):TTexture
Defined in: libs/scene/src/render/rendergraph/types.ts:507
Allocate a transient texture matching the given descriptor and resolved size.
Parameters
desc
The texture descriptor from the pass builder.
size
The resolved pixel dimensions.
Returns
TTexture
The allocated texture object.
release()
release(
texture):void
Defined in: libs/scene/src/render/rendergraph/types.ts:514
Release a previously allocated transient texture back to the pool.
Parameters
texture
TTexture
The texture to release.
Returns
void
retain()?
optionalretain(texture):void
Defined in: libs/scene/src/render/rendergraph/types.ts:528
Retain a texture allocated by this allocator so it can outlive the graph pass that produced it.
This is used when a graph-produced transient texture must be handed off to an external owner, such as a cross-frame history resource. Executors still release the graph's own reference at the resource's last use; the external owner must later call RGTextureAllocator.release for the retained reference.
Allocators that cannot retain transient textures should leave this undefined.
Parameters
texture
TTexture
Returns
void
allocateFramebuffer()?
optionalallocateFramebuffer(desc):TFramebuffer
Defined in: libs/scene/src/render/rendergraph/types.ts:539
Allocate a temporary framebuffer matching the given descriptor.
Implementations should not auto-release this framebuffer; the graph executor calls RGTextureAllocator.releaseFramebuffer when execution completes or aborts.
Parameters
desc
Framebuffer descriptor.
Returns
TFramebuffer
The allocated framebuffer object.
releaseFramebuffer()?
optionalreleaseFramebuffer(framebuffer):void
Defined in: libs/scene/src/render/rendergraph/types.ts:546
Release a previously allocated temporary framebuffer.
Parameters
framebuffer
TFramebuffer
The framebuffer to release.
Returns
void