API

Interface CopyToTextureTaskConfig

Options used to create a copy-to-texture frame-graph task. Selects the source render target, the target or resolve target, and optional viewport / mip-level settings for blit and copy paths.

interface CopyToTextureTaskConfig {
    lodLevel?: number;
    name?: string;
    ownsTargetTexture?: boolean;
    resolveTexture?: RenderTarget;
    sourceTexture: RenderTarget;
    targetTexture?: RenderTarget;
    viewport?: NormalizedViewport | null;
}
Index
lodLevel?: number

View-relative source mip level. Default 0. A texture-backed wrapper exposes one mip, so LOD clamps to zero and both paths read its selected physical mip. Ordinary sources use this as their source mipLevel or textureSampleLevel LOD.

name?: string
ownsTargetTexture?: boolean

When true, this task owns targetTexture: it rebuilds the target on every frame-graph build (including canvas resize) and disposes it with the task. Leave false for externally owned targets.

resolveTexture?: RenderTarget

Optional single-sample texture that receives a hardware MSAA-resolve of the task's MSAA color attachment at end-of-pass. Two modes:

  • Blit + resolve: targetTexture is MSAA and resolveTexture is SS. The shader blit writes into targetTexture and at end-of-pass the GPU resolves targetTexture into resolveTexture.

  • Resolve-only: targetTexture is omitted. The task runs a no-draw render pass with sourceTexture as the color attachment (so the source itself must be MSAA) and resolveTexture as its resolve target. viewport and lodLevel are ignored. sourceTexture and resolveTexture must have matching dimensions.

In both modes, resolveTexture.format must match the MSAA attachment's format and resolveTexture must be single-sample.

sourceTexture: RenderTarget

Source render target. The engine swapchain render target is not supported because its GPU texture changes every frame.

targetTexture?: RenderTarget

Target attachment that receives the blit. Required UNLESS resolveTexture is set, in which case the task does a resolve-only operation and writes directly into resolveTexture.

viewport?: NormalizedViewport | null

Viewport applied to the target before the blit. When undefined (default), the whole target is overwritten and the encoder-copy fast path becomes available. When set, the blit path is used.