[suggestion] desynchronized canvas and offscreencanvas in a worker (processing w/o 'client-side')
eladkarako opened this issue · comments
Hi,
There are few new stuff (to this date) that might be helpful,
-
the desynchronized-canvas is a new feature added https://www.chromestatus.com/features/6360971442388992
and explained mostly just by example below and https://blog.chromium.org/2019/05/chrome-75-beta-low-latency-canvas.html.
It should be fine (ignored) if not supported, and if it does have support it should accelerate in some way your existing canvas operation.
let context_type = '2d'; // Or 'webgl' canvas.getContext(context_type, {desynchronized: true});
-
the offscreencanvas API got a lot more documentations,
and few example pages created by Chrome.
Essentially you can do most of the processing in a canvas that exist on a worker alone,
without (or limiting) the need of placing a canvas on the 'main-thread',
it was designed mostly for
webGL
but you can use it in2d
as well.https://ebidel.github.io/demos/offscreencanvas.html
tryview-source:https://ebidel.github.io/demos/offscreencanvas.html
https://wiki.whatwg.org/wiki/OffscreenCanvas
(just for reference) https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface(and when done you can still postMessage back the typed-array's context (Transferable) as you do now).