Offscreen canvas flickers |
||||
Issue descriptionChrome Version: Version 69.0.3476.0 (Official Build) canary (64-bit) OS: MacOS 10.13.15 GPU: NVIDIA GeForce GT 750M 2048 MB What steps will reproduce the problem? (1) http://jsfiddle.net/greggman/gmpkvu30/ (2) size the window What is the expected result? Here is no flicker What happens instead? Lots of flicker. Note if resizing is not required to see the flicker but at least with a small window it makes it more likely. On a fullscreen example it flickers without resizing Please use labels and text to provide additional information. If this is a regression (i.e., worked before), please consider using the bisect tool (https://www.chromium.org/developers/bisect-builds-py) to help us identify the root cause and more rapidly triage the issue. For graphics-related bugs, please copy/paste the contents of the about:gpu page at the end of this report.
,
Jul 3
Perhaps we should add a warning then?
,
Jul 4
It shouldn't flicker regardless of use. It is not required to constantly render to a canvas so even if it's skipping frames because of incorrect use it should not flicker.
,
Jul 4
Here's a perfectly valid usecase http://jsfiddle.net/greggman/y36aujrf/ It's trying to render at 15fps so it does this let then = -1000; function loop(time) { time *= 0.001; const elapsed = time - then; if (elapsed > 1 / 15) { then = time; render(); gl.commit(); } requestAnimationFrame(loop); } requestAnimationFrame(loop);
,
Jul 5
requestAnimationFrame() on a web worker has (or seems to have) the semantic that it automatically commits updates to the OffscreenCanvas contexts which are updated within its callback's scope, similarly to how the main thread's requestAnimationFrame works. For this reason it's an error to call commit() from within a worker's requestAnimationFrame callback. The spec should be changed to make commit() throw an exception in this case. Some work is in progress on the specs in https://github.com/whatwg/html/pull/3677 and another pull request which I can't find immediately. Here's an update of your resizing example which removes the incorrect call to commit() and works well: http://jsfiddle.net/gmpkvu30/2/ and an update of your 15 FPS rendering example which removes the call to commit() and works well: http://jsfiddle.net/y36aujrf/3/ Thanks for putting these together; we should change the spec and implementation so that they clearly show incorrect uses of the API and work well cross-browser.
,
Jul 6
|
||||
►
Sign in to add a comment |
||||
Comment 1 by fs...@chromium.org
, Jul 3