Skip to content

@orillusion/core


Class: RenderGraphRenderTarget ​

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:144

Typed render target = color attachment(s) + (optional) depth + creation description. Wraps RTFrame without replacing it — the rtFrame field is still the single source of truth that WebGPUDescriptorCreator.createRendererPassState consumes.

Two construction modes:

  • Adopt via fromRTFrame: bind to an externally-allocated RTFrame (typical: GBufferFrame). The RT does not own the underlying RenderTextures; cleanup is the source's responsibility.
  • Allocate via allocate: allocate fresh RenderTextures through RTResourceMap.createRTTexture (auto-resize via the texture's built-in resize handler) and compose them into a private RTFrame.

Multi-writer rule: only one pass creates the RT (calls b.createRenderTarget / b.adoptRenderTarget). Downstream passes call b.useRenderTarget(name) (or b.borrowRenderTarget(name)) to record a mutator-write and obtain the same RT handle; the encoder is opened in execute() via beginPass.

Constructors ​

Constructor ​

new RenderGraphRenderTarget(name, desc, rtFrame, owned): RenderGraphRenderTarget

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:181

Use fromRTFrame or allocate — direct construction is reserved for internal use.

Parameters ​

name ​

string

desc ​

RenderGraphRenderTargetDesc

rtFrame ​

RTFrame

owned ​

boolean

Returns ​

RenderGraphRenderTarget

Properties ​

name ​

readonly name: string

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:146

Pool handle name.


desc ​

readonly desc: Readonly<RenderGraphRenderTargetDesc>

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:147


rtFrame ​

readonly rtFrame: RTFrame

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:148


colorTextures ​

readonly colorTextures: readonly RenderTexture[]

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:149


depthTexture ​

readonly depthTexture: RenderTexture

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:150


sampleCount ​

readonly sampleCount: number

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:151


owned ​

readonly owned: boolean

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:155

True if this RT owns the underlying textures (allocate mode). False for adopt mode — textures are owned by the upstream RTFrame source (e.g. GBufferFrame).

Methods ​

fromRTFrame() ​

static fromRTFrame(name, rtFrame, opts?): RenderGraphRenderTarget

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:202

Adopt an externally-allocated RTFrame. The wrapper does not own the textures; only descriptor / cache state is reset on destroy. Typical use: GBufferResourcePass wraps a GBufferFrame.

Parameters ​

name ​

string

rtFrame ​

RTFrame

opts? ​
label? ​

string

Returns ​

RenderGraphRenderTarget


allocate() ​

static allocate(name, ctx, desc): RenderGraphRenderTarget

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:239

Allocate fresh textures via RTResourceMap (auto-resize inherited) and assemble a private RTFrame. The per-attachment cache key in RTResourceMap is "<rt-name>::<attachment-name>" to avoid colliding with other registries that use bare attachment names.

Parameters ​

name ​

string

ctx ​

Context3D

desc ​

RenderGraphRenderTargetDesc

Returns ​

RenderGraphRenderTarget


beginPass() ​

beginPass(ctx, opts): OpenedRenderPass

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:314

Open a render pass on this target. Resolves the load-op combination against the auto-derive rule (first-writer ⇒ clear, subsequent ⇒ load) unless opts overrides it, looks up (or builds) the cached RendererPassState for that resolved bucket, opens a fresh GPUCommandEncoder + render-pass encoder, and returns the encoder + state.

Each invocation opens an independent command encoder. WebGPU does not require encoders to be shared across passes for loadOp='load' chaining — the attachment contents carry over, not the encoder identity.

Pair every successful call with endPass (typically in a try/finally).

Parameters ​

ctx ​

RenderGraphPassContext

opts ​

BeginPassOptions

Returns ​

OpenedRenderPass


endPass() ​

endPass(ctx, opened): void

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:401

Close a pass opened with beginPass and submit the per-pass command buffer.

Parameters ​

ctx ​

RenderGraphPassContext

opened ​

OpenedRenderPass

Returns ​

void


destroy() ​

destroy(_ctx): void

Defined in: src/gfx/renderJob/graph/RenderGraphRenderTarget.ts:448

Release per-RT framework state. Owned textures are not destroyed here — RTResourceMap retains them so that a subsequent graph rebuild can reuse them without reallocating. Pass authors that want explicit destruction must do it themselves.

Parameters ​

_ctx ​

Context3D

Returns ​

void