A video as a WebGPU external texture under HTML cards

The two cards below are HTML. The video frame behind them is a separate texture, and one shader pass draws all three: the cards are glass that bends and blurs the frame. Type in the field, press the buttons, change the effect and tap the picture. "Measure on this device" times each way of getting the frame and the cards to the GPU.

Frame 0

HTML over video

Show the code one pass over a video texture and two element textures, on three routes
  1. The markup. Two drawable cards and a <video> that is a child of the canvas but not of a drawn element.
  2. The CSS. The cards have no background. The shader draws it.
  3. The frame on WebGPU. importExternalTexture() first, then copyExternalImageToTexture().
  4. The WebGPU route. Upload each card with drawElementImageToTexture(), import the frame, draw.
  5. The render pass. The bind group is made again for each frame, because an external texture can't be kept.
  6. The WGSL shader. texture_external and two texture_2d in one fragment shader.
  7. Where the cards go. The page computes each card's position. CSS left and top don't move a canvas child.
  8. Hit testing. updateElementGeometry() with a translation to where the shader draws the card.
  9. The WebGL 2 route.
  10. The WebGL uploads. texImage2D(video) and texElementSubImage2D().
  11. The GLSL shader.
  12. The 2D route. drawImage(video), drawElementImage(), filters and compositing.
  13. The measurement on WebGPU.

Measure on this device

Each route draws the same small picture 40 times, one draw per video frame, into a texture that isn't shown. The picture above pauses while this runs. It takes about 20 seconds.

Not measured yet.

How it works

Live checks

Each check builds its own small canvas in a corner of the window. The WebGPU checks draw into a texture and read it back, so they also run on a software adapter. The picture above isn't touched.

ResultExperimentDetail

Findings

From Chromium 157 headless with a software WebGPU adapter (SwiftShader) and software video decoding, 2026-11-21. The rows above say what your browser does.