Skip to content

OffscreenCanvas #161

Closed
Closed

Description

@fserb

Description

OffscreenCanvas allows for a faster graphics API that is detached from the Document. It also enables out-of-main-thread graphics API on WebWorkers. The support should include 2D, WebGL, and WebGPU support, both on main thread and on workers.

Rationale

OffscreenCanvas on Workers has a pretty strong developer demand. We can see tutorials and demos all over the place. Developers recognize and identify the multiple use cases: out of main thread rendering, and faster DOM-independent operations. OffscreenCanvas is also widely used inside Google.

On WASM codebases, it’s a necessary API to support out-of-main-thread rendering, which is common in games (with the WebGL context).

For 2D context, the extra performance (a lot of operations are faster on OffscreenCanvas due to its independence from the Document and style) and the ability to step outside the main thread processing (which is often a contentious resource), makes it a widely used feature.

Firefox tracking bug: OffscreenCanvas, 2D.
WebKit tracking bug: OffscreenCanvas.

Specification

WHATWG relevant spec:
https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface

The spec needs some refreshment that we are ready to work on and would do it sooner, if this gets picked up by Interop: we need to clean up the old commit() spec that doesn’t exist anymore, and write a new rendering model for Workers.

Tests

Canvas2D: wpt/html/canvas/offscreen
WebGL: wpt/webgl
WebGPU: gpuweb/cts

The coverage for 2D is pretty broad, including WebWorker, transferred OffscreenCanvas, and main thread.
WebGL has a worker.js IDL test, but it seems to be missing on the repo.
WebGPU has only minor coverage on WPT. We would add at least some basic usage tests (not the full CTS).

Activity

  1. benjamind commented on Sep 28, 2022

    @benjamind

    We at Adobe are strongly in support of adding this!

    OffscreenCanvas is an essential capability for highly performant apps that do any sort of rendering.

  2. added this to the milestone on Sep 29, 2022
  3. moved this to Proposed in Interop 2023on Oct 7, 2022
  4. removed this from the milestone on Oct 7, 2022
  5. foolip commented on Nov 11, 2022

    @foolip
    Member

    In the MDN short survey on APIs & JavaScript, "OffscreenCanvas" was selected by ~12% of survey takers, putting it in the bottom third of options. (There is some uncertainty as with any survey data.)

  6. jgraham commented on Nov 16, 2022

    @jgraham
    Contributor

    We think that this should exclude canvas filter tests, since that's just part of the normal canvas API that isn't directly related to offscreen canvas.

  7. added
    accepted
    on Feb 1, 2023
  8. foolip commented on Feb 1, 2023

    @foolip
    Member

    Thank you for proposing Offscreen Canvas for inclusion in Interop 2023.

    We are pleased to let you know that this proposal was accepted as the Offscreen Canvas focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard.

    For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023!

    Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfocus-area-proposal

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions