API

Function uploadImageToArrayLayer

  • Fill one layer of a texture array from an already-decoded external image source — an ImageBitmap, ImageData, canvas (HTMLCanvasElement / OffscreenCanvas), HTMLImageElement, HTMLVideoElement, or VideoFrame. All of these are accepted directly by WebGPU's copyExternalImageToTexture, so this is a single GPU copy with no per-source-type branching. If the array was created with mipmaps, the layer's mip chain is regenerated after upload.

    Parameters

    • engine: EngineContext

      Engine context.

    • tex: Texture2DArray

      Target texture array (from createTexture2DArray).

    • layer: number

      Destination layer index in [0, tex.layers).

    • source: GPUCopyExternalImageSource

      Any WebGPU external-image source sized tex.width×tex.height.

    • opts: ArrayLayerUploadOptions = {}

      Flip-Y / premultiply overrides.

    Returns void