web api interface
GPUExternalTexture
Secure contextAvailable in workers
The GPUExternalTexture interface of the WebGPU API represents a wrapper object containing an HTMLVideoElement snapshot that can be used as a texture in GPU rendering operations.
A GPUExternalTexture object instance is created using importExternalTexture().
Instance properties
label- : A string providing a label that can be used to identify the object, for example in
GPUErrormessages or console warnings.
- : A string providing a label that can be used to identify the object, for example in
Examples
In the WebGPU samples Video Uploading sample, a GPUExternalTexture object (created via a importExternalTexture() call) is used as the value of a bind group entry resource, specified when creating a GPUBindGroup via a createBindGroup() call:
// …
const uniformBindGroup = device.createBindGroup({
layout: pipeline.getBindGroupLayout(0),
entries: [
{
binding: 1,
resource: sampler,
},
{
binding: 2,
resource: device.importExternalTexture({
source: video,
}),
},
],
});
// …
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- The WebGPU API