Skip to content

Documentation / scene / RGPassBuilder

Interface: RGPassBuilder

Defined in: libs/scene/src/render/rendergraph/types.ts:241

Builder interface used within the setup callback of RenderGraph.addPass to declare a pass's resource requirements.

Methods

read()

read(handle): void

Defined in: libs/scene/src/render/rendergraph/types.ts:249

Declare a read dependency on an existing resource.

The resource must have been created by a prior pass or imported into the graph.

Parameters

handle

RGHandle

Handle of the resource to read.

Returns

void


write()

write(handle): RGHandle

Defined in: libs/scene/src/render/rendergraph/types.ts:264

Declare that this pass writes a new version of an existing resource.

The returned handle represents the post-write version. Use it for subsequent reads and as the graph output passed to RenderGraph.compile. Passing an older version of the same resource to compile() is rejected because it usually means the caller ignored the handle returned by write(). If the pass needs the previous contents, call RGPassBuilder.read on the input handle explicitly before writing.

Parameters

handle

RGHandle

Handle of the resource to write to.

Returns

RGHandle

A handle referencing the newly written version.


createTexture()

createTexture(desc): RGHandle

Defined in: libs/scene/src/render/rendergraph/types.ts:272

Create a new transient texture resource that this pass will produce.

Parameters

desc

RGTextureDesc

Texture descriptor.

Returns

RGHandle

A handle referencing the newly created resource.


createToken()

createToken(name?): RGHandle

Defined in: libs/scene/src/render/rendergraph/types.ts:284

Create a logical dependency token produced by this pass.

Tokens do not resolve to GPU resources and are not allocated by the executor. They are useful for ordering passes whose dependencies are side effects rather than texture reads/writes.

Parameters

name?

string

Debug label for this token.

Returns

RGHandle

A handle referencing the newly created token.


createFramebuffer()

createFramebuffer(desc): RGHandle

Defined in: libs/scene/src/render/rendergraph/types.ts:295

Create a graph-managed framebuffer view.

The graph compiler infers dependencies from any attachment handles in the descriptor. The executor creates and releases the framebuffer automatically.

Parameters

desc

RGFramebufferDesc

Framebuffer descriptor.

Returns

RGHandle

A handle referencing the framebuffer view.


sideEffect()

sideEffect(): void

Defined in: libs/scene/src/render/rendergraph/types.ts:304

Mark this pass as having side effects.

Side-effect passes are never culled by the graph compiler, regardless of whether their outputs are consumed. Use this for GPU readback, picking, debug overlays, etc.

Returns

void


addSubpass()

addSubpass<D>(name, fn): void

Defined in: libs/scene/src/render/rendergraph/types.ts:316

Add an ordered logical subpass to this pass.

Subpasses execute in registration order and share the parent pass's declared reads, writes, framebuffer views, and user data. A pass may use either subpasses or RGPassBuilder.setExecute, but not both.

Type Parameters

D

D

Parameters

name

string

Debug label for the subpass.

fn

RGExecuteFn<D>

Callback invoked when this subpass executes.

Returns

void


setExecute()

setExecute<D>(fn): void

Defined in: libs/scene/src/render/rendergraph/types.ts:325

Set the execution callback for this pass.

A pass may use either this method or RGPassBuilder.addSubpass, but not both.

Type Parameters

D

D

Parameters

fn

RGExecuteFn<D>

Callback invoked during graph execution.

Returns

void

Released under the MIT License.