Skip to content

Make media elements and createCapture() work in WebGPU - #9358

Merged
davepagurek merged 6 commits into
mainfrom
fix/webgpu-media-elements
Oct 30, 2026
Merged

davepagurek merged 6 commits into
mainfrom
fix/webgpu-media-elements

Conversation

@davepagurek

Copy link
Copy Markdown
Contributor

Resolves #9357

Changes:

  • Handles some readyState values of media elements that WebGL natively seems to just handle but that we need to explicitly handle in WebGPU. Basically just waiting to actually draw stuff until it's ready
  • Handles what seems to be a current Firefox limitation where WebGPU doesn't support video elements as textures yet. Presumably this will work in the future. But in the mean time if we see this fail, we catch the error and fall back to drawing the video through a canvas first. So this should just start doing the more efficient thing in Firefox when that works.
  • Handles element source size changing dynamically. When it first goes through it has size 0 because the stream isn't available yet, but then this size gets cached and never changes. So now WebGPU looks for this and makes a new texture when it happens.

PR Checklist

@p5-bot

p5-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: 3599208

Previous deployments

e23d089


This is an automated message.

@davepagurek
davepagurek merged commit 1ae94e6 into main Oct 30, 2026
8 checks passed
@davepagurek
davepagurek deleted the fix/webgpu-media-elements branch October 30, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[p5.js 2.0+ Bug Report]: Can't draw webcam to canvas in WebGPU mode

1 participant