gfx-rs/wgpu · error

importExternalTexture failed

Error message

importExternalTexture failed

What it means

Panic in the WebGPU backend's import_external_texture: the browser's GPUDevice.importExternalTexture call rejected the descriptor/source, so no external texture object could be produced from the given HTMLVideoElement/VideoFrame.

Source

Thrown at wgpu/src/backend/webgpu.rs:1969

    /// The browser performs the YCbCr-to-RGB conversion internally. The result is
    /// valid only while the source is: a `VideoFrame` until it is closed, an
    /// `HTMLVideoElement` for the current task.
    pub(crate) fn import_external_texture(
        &self,
        source: &ExternalTextureSource,
    ) -> dispatch::DispatchExternalTexture {
        let descriptor = match source {
            ExternalTextureSource::HtmlVideoElement(v) => {
                webgpu_sys::GpuExternalTextureDescriptor::new(v)
            }
            ExternalTextureSource::VideoFrame(f) => {
                webgpu_sys::GpuExternalTextureDescriptor::new_with_video_frame(f)
            }
        };
        let inner = self
            .inner
            .import_external_texture(&descriptor)
            .expect("importExternalTexture failed");
        WebExternalTexture {
            inner,
            ident: crate::cmp::Identifier::create(),
        }
        .into()
    }
}

impl dispatch::DeviceInterface for WebDevice {
    fn features(&self) -> crate::Features {
        map_wgt_features(self.inner.features())
    }

    fn limits(&self) -> crate::Limits {
        map_wgt_limits(self.inner.limits())
    }

    fn adapter_info(&self) -> crate::AdapterInfo {

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Ensure the video source is usable (playing, not closed, same-origin/CORS-clean) before importing
  2. Re-import per-frame since external textures expire with the source
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at wgpu/src/backend/webgpu.rs:1969 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/6d6db97b5a991e3b. Report an issue: GitHub.