KhronosGroup / KhronosGroup/WebGL

Clarify/test transferToImageBitmap() on on-screen canvases

Open
#3,695 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
2.9k
Forks
703
Avg merge
2d 9h
Merged PRs (30d)
4

Description

(To be clear I don't think this is very important, but I wrote a test case so I wanted to share it here - maybe someday it will matter enough to someone to iron out.)

`transferToImageBitmap()` can be called on `OffscreenCanvas`es which are actually on-screen via `transferControlToOffscreen()`. Thus the compositor and `transferToImageBitmap()` can both try to take frames from the canvas.

Here's a sample page: https://codepen.io/kainino0x/pen/dyxoNRd

It raises issues like:
- It's probably not tested that `preserveDrawingBuffer` doesn't apply to `transferToImageBitmap` (chrome gets this wrong)
- It's unclear what should happen when calling `transferToImageBitmap` on a canvas that has `preserveDrawingBuffer: false` _after_ it has been presented (get the presented canvas's contents? get nothing and clear the presented canvas? get nothing but leave up the presented canvas?)
- Should `transferToImageBitmap()` really work at all with `transferControlToOffscreen()`? Would be curious to see if any websites do that.

BTW in various browsers some of the canvas images will eventually "expire" if left in the background for long enough, which AFAIU is intended to be allowed with `preserveDrawingBuffer: false` but maybe not otherwise.

See also #3612, #3615

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodePen sample and the behavior described for transferToImageBitmap(), OffscreenCanvas, transferControlToOffscreen(), and preserveDrawingBuffer. Compare the relevant behavior across browsers and review related issues #3612 and #3615. Done means the expected behavior is clarified and the ambiguity is covered by a test case.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
computer-graphics, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.