API

Interface RenderTaskConfig

Configuration for createRenderTask: render target, clear state, optional camera override, and transmission settings.

interface RenderTaskConfig {
    autoMirror?: boolean;
    cam?: Camera | null;
    clr?: boolean;
    clrColor?: GPUColorDict;
    cs?: boolean;
    depth?: RenderTarget;
    depthClear?: boolean;
    name: string;
    rst?: RenderTarget;
    rt: RenderTarget;
    sharedRt?: boolean;
    transmission?: {
        copyCount?: number;
        generateMipmaps?: boolean;
        grabDepth?: boolean;
        mipLevelCount?: number;
    };
}
Index
autoMirror?: boolean

Set false for an explicit render list that never auto-mirrors the scene's renderables, even while the task list is empty. Undefined preserves the default auto-mirror behavior.

cam?: Camera | null

Per-pass camera override. Null/undefined uses scene.camera.

clr?: boolean

When true, color loadOp is "clear"; when false, "load" (overlays previous color content). Depth is cleared when rt-owned (unless depthClear: false) and follows the eager/task-managed ownership policy when supplied via depth.

clrColor?: GPUColorDict

Background clear color. May be mutated frame-to-frame.

cs?: boolean

Use canvas dimensions, not render-target dimensions, for this pass's scene UBO aspect.

depth?: RenderTarget

Optional separate depth/stencil attachment. The pass binds this target's depth view instead of rt's own, and uses its depthStencilFormat for pipeline signature matching. The colour rt must omit depthStencilFormat (so it allocates no internal depth) and match this target in size + sample count. Two ownership modes, distinguished by _eager:

  • _eager depth (e.g. a GeometryRendererTask output): the task neither builds nor clears nor disposes it — it loads it (loadOp: "load") and the caller owns clearing. This is how scenes reuse a pre-rendered depth buffer.
  • non-_eager depth: the task owns it — builds/rebuilds it in record(), clears it (loadOp: "clear"), and disposes it. Used by the default single-sample scene task, whose colour rt is the depth-less engine scRT.
depthClear?: boolean

rt-owned depth loadOp. Default true = "clear" (unchanged behaviour). Set false so an overlay task drawn into another task's target LOADS that target's existing depth and can depth-test against the scene already rendered there. Ignored when depth is supplied (an external depth is always loaded when eager, task-managed otherwise).

name: string

Optional single-sample resolve target. When rt is multisampled (sampleCount > 1), the color attachment resolves into this target's color texture at end-of-pass — letting an MSAA render feed a post-process that requires a single-sample source, without an extra resolve pass. Caller contract (not validated): must be single-sample with a color format and size matching rt; WebGPU errors at pass-encode time if not. Ignored when rt is single-sample.

TODO: rt should not live in this config long-term. Until texture management is virtualized, callers must provide the concrete target; once virtualized, the task should create/manage its own render target.

sharedRt?: boolean

This task draws into a target OWNED BY ANOTHER TASK: it neither builds nor disposes rt/ rst (the owner does; record() here only wires the pass to the owner's live views, so the owning task must be recorded first — place this task after it). Pair with clr: false and depthClear: false for a full overlay pass. Default false.

transmission?: {
    copyCount?: number;
    generateMipmaps?: boolean;
    grabDepth?: boolean;
    mipLevelCount?: number;
}

Scene-texture transmission settings. copyCount: 0 copies before every transmissive draw. generateMipmaps: false allocates only mip 0 for the refraction texture and skips mip generation. mipLevelCount caps the generated chain when a material only samples low explicit LODs. grabDepth: true also snapshots the task's DEPTH attachment at the same mid-pass grab (see TransmissionOptions.grabDepth).