Function createTexture2DFromExternalImage
-
createTexture2DFromExternalImage(
engine: EngineContext,
source: GPUCopyExternalImageSource,
options?: ExternalImageTexture2DOptions,
): Promise<Texture2D>Parameters
- engine: EngineContext
Engine context.
- source: GPUCopyExternalImageSource
An already-decoded WebGPU external-image source.
- options: ExternalImageTexture2DOptions = {}
Sampler, format, upload, and optional downscaling overrides.
Returns Promise<Texture2D>
A newly allocated texture. Resize/decode and upload failures reject.
- engine: EngineContext
Create a fresh, normal Texture2D from an already-decoded external image. Supported sources are the platform types accepted by WebGPU's
copyExternalImageToTexture, includingImageBitmap,ImageData, DOM or offscreen canvases, image/video elements, andVideoFrame.Every invocation allocates a distinct GPU texture; no source or URL cache is used. The caller keeps ownership of
source, and this function never closes it. The returned texture owns one resource-pool reference and must be released withreleaseTextureafter it is detached from all materials.