Skip to content

Documentation / scene / RenderGraphExecutor

Class: RenderGraphExecutor<TTexture, TFramebuffer>

Defined in: libs/scene/src/render/rendergraph/executor.ts:74

Executes a compiled render graph with automatic resource lifecycle management.

The executor allocates transient textures before their first use and releases them after their last use, using the provided RGTextureAllocator.

Usage:

ts
const executor = new RenderGraphExecutor(myAllocator, backbufferWidth, backbufferHeight);
executor.setImportedTexture(backbufferHandle, actualBackbufferTexture);
executor.execute(compiledGraph);

Type Parameters

TTexture

TTexture = unknown

The concrete texture type (e.g. Texture2D).

TFramebuffer

TFramebuffer = unknown

Constructors

Constructor

new RenderGraphExecutor<TTexture, TFramebuffer>(allocator, backbufferWidth, backbufferHeight, options?): RenderGraphExecutor<TTexture, TFramebuffer>

Defined in: libs/scene/src/render/rendergraph/executor.ts:110

Parameters

allocator

RGTextureAllocator<TTexture, TFramebuffer>

backbufferWidth

number

backbufferHeight

number

options?

RenderGraphExecutorOptions

Returns

RenderGraphExecutor<TTexture, TFramebuffer>

Methods

setDefaultProfilingOptions()

static setDefaultProfilingOptions(options): void

Defined in: libs/scene/src/render/rendergraph/executor.ts:128

Set the default profiling options used by newly constructed render graph executors.

Parameters

options

boolean | RGProfilingOptions

Returns

void


getLatestProfileResult()

static getLatestProfileResult(): RGProfileResult

Defined in: libs/scene/src/render/rendergraph/executor.ts:135

Get the latest resolved profile result from any render graph executor.

Returns

RGProfileResult


resolveProfileResult()

static resolveProfileResult(): Promise<RGProfileResult>

Defined in: libs/scene/src/render/rendergraph/executor.ts:142

Resolve the latest pending render graph profile result from any executor.

Returns

Promise<RGProfileResult>


setProfilingOptions()

setProfilingOptions(options): void

Defined in: libs/scene/src/render/rendergraph/executor.ts:152

Enable, disable, or update timestamp profiling for this executor.

Parameters

options

boolean | RGProfilingOptions

Returns

void


getLatestProfileResult()

getLatestProfileResult(): RGProfileResult

Defined in: libs/scene/src/render/rendergraph/executor.ts:159

Get the latest resolved profile result produced by this executor.

Returns

RGProfileResult


resolveProfileResult()

resolveProfileResult(): Promise<RGProfileResult>

Defined in: libs/scene/src/render/rendergraph/executor.ts:166

Resolve the latest pending profile result produced by this executor.

Returns

Promise<RGProfileResult>


setBackbufferSize()

setBackbufferSize(width, height): void

Defined in: libs/scene/src/render/rendergraph/executor.ts:176

Update the backbuffer dimensions used for 'backbuffer-relative' sizing.

Parameters

width

number

height

number

Returns

void


setImportedTexture()

setImportedTexture(handle, texture): void

Defined in: libs/scene/src/render/rendergraph/executor.ts:187

Register an imported (external) texture so it can be resolved during execution.

Parameters

handle

RGHandle

The handle returned from RenderGraph.importTexture.

texture

TTexture

The actual GPU texture object.

Returns

void


execute()

execute(compiled): void

Defined in: libs/scene/src/render/rendergraph/executor.ts:201

Execute the compiled graph with full resource lifecycle management.

For each pass in topological order:

  1. Allocate any transient resources whose lifetime begins at this pass
  2. Invoke the pass's execute callback with a context that resolves handles
  3. Release any transient resources whose lifetime ends at this pass

Parameters

compiled

CompiledRenderGraph

The compiled graph from RenderGraph.compile.

Returns

void


reset()

reset(): void

Defined in: libs/scene/src/render/rendergraph/executor.ts:388

Clear imported texture registrations and any leftover allocated textures. Call this after execution or when resetting for a new frame.

Returns

void

Released under the MIT License.