Skip to main content

ExternalTexture

WebGPU supportedWebGL2 not supported

ExternalTexture is the low-level concrete WebGPU GPUExternalTexture binding for browser-owned texture data. It is a one-shot resource, not the engine-level live video helper. Use VideoTexture when a model or material should follow a playing video across frames.

Since WebGPU external textures are acquired per frame, bindings that use them must be prepared again for each draw:

function onFrame() {
requestAnimationFrame(onFrame);

const externalTexture = device.createExternalTexture({source: video});

model.setBindings({videoTexture: externalTexture});

model.draw(renderPass);
}
requestAnimationFrame(onFrame);

ExternalTextureProps accepts source?: HTMLVideoElement | VideoFrame, colorSpace?: 'srgb', an optional default sampler, and normal ResourceProps. Handle-backed opaque WebGPU external textures also require width and height when luma cannot infer them from a source.