Skip to content

Documentation / scene / DevicePoolAllocator

Class: DevicePoolAllocator

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:22

Bridges the render graph's RGTextureAllocator interface to the engine's device resource pool (device.pool).

Transient textures are fetched from the pool on allocate() and returned to the pool on release(), enabling automatic reuse across frames without manual lifecycle management.

Usage:

ts
const allocator = new DevicePoolAllocator();
const executor = new RenderGraphExecutor(allocator, width, height);

Implements

Constructors

Constructor

new DevicePoolAllocator(device?): DevicePoolAllocator

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:28

Creates a new instance of the DevicePoolAllocator.

Parameters

device?

AbstractDevice

Optional device instance to use for resource allocation. If not provided, the global device will be used.

Returns

DevicePoolAllocator

Methods

allocate()

allocate(desc, size): Texture2D

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:38

Allocate a transient texture from the device pool.

Parameters

desc

RGTextureDesc

Texture descriptor from the render graph pass.

size

RGResolvedSize

Resolved pixel dimensions.

Returns

Texture2D

A pooled Texture2D instance.

Implementation of

RGTextureAllocator.allocate


release()

release(texture): void

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:76

Release a transient texture back to the device pool.

Parameters

texture

Texture2D

The texture to release.

Returns

void

Implementation of

RGTextureAllocator.release


retain()

retain(texture): void

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:86

Retain a pooled texture so it can be owned outside the graph lifetime.

Parameters

texture

Texture2D

The texture to retain.

Returns

void

Implementation of

RGTextureAllocator.retain


allocateFramebuffer()

allocateFramebuffer(desc): FrameBuffer

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:97

Allocate a temporary framebuffer from the device pool.

Parameters

desc

RGFramebufferDesc

Framebuffer descriptor from the render graph pass.

Returns

FrameBuffer

A pooled FrameBuffer instance.

Implementation of

RGTextureAllocator.allocateFramebuffer


releaseFramebuffer()

releaseFramebuffer(framebuffer): void

Defined in: libs/scene/src/render/rendergraph/device_pool_allocator.ts:125

Release a temporary framebuffer back to the device pool.

Parameters

framebuffer

FrameBuffer

The framebuffer to release.

Returns

void

Implementation of

RGTextureAllocator.releaseFramebuffer

Released under the MIT License.