Skip to content

feat: add opt-in WebGL rendering for Canvas video - #62

Merged
fython merged 1 commit into
mainfrom
feat/experimental-canvas-webgl
Nov 15, 2026
Merged

fython merged 1 commit into
mainfrom
feat/experimental-canvas-webgl

Conversation

@fython

@fython fython commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Adds a default-off “Use WebGL for Canvas (experimental)” option to the browser connection settings. Users can enable it for Compatibility Canvas or Direct Canvas; Native Video keeps its existing behavior. The browser saves the choice for the next manual connection, while automatic reconnects retain the active session’s selection.

  • Reuses a texture, vertex buffer and shader program for Video / VideoFrame uploads, with GPU resource cleanup and context-loss recovery.
  • Keeps Canvas 2D as the default and uses it when WebGL context acquisition is unavailable. Separate canvas surfaces allow switching the experiment on and off without a page reload; later WebGL failures use the existing image fallback.
  • Preserves frame deduplication, resize handling, recovery snapshots and VideoFrame ownership; adds renderBackend diagnostics and English / Simplified Chinese / Traditional Chinese copy.

Validation: npm run check, all 232 Node tests, npm run test:browser:webgl, and npm run test:browser:media pass after rebasing onto current main. Chromium checks cover colors/orientation, rotation, real video and VideoFrame uploads, context restoration, 2D fallback, and saved opt-in/opt-out across reloads. The media test reports native fullscreen transitions as untested because fullscreen did not enter in this environment.

Performance gains have not been measured on a head unit. Browser GPU uploads and preserveDrawingBuffer can add overhead; this remains an opt-in experiment without a frame-rate improvement claim.

@fython
fython merged commit aef2b68 into main Nov 15, 2026
3 checks passed
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.

2 participants