New issue
Advanced search Search tips
Starred by 90 users
Implement and ship the OffscreenCanvas feature
Project Member Reported by junov@chromium.org, Dec 1 2015 Back to list
Spec is a work in progress at this time.
Feature proposal: https://wiki.whatwg.org/wiki/OffscreenCanvas
Mozilla's implementation, for reference/compat: https://bugzilla.mozilla.org/attachment.cgi?id=8662255&action=diff
 
Comment 1 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:249384
Comment 2 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563819
Comment 3 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563826
Comment 4 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563827
Comment 5 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563830
Comment 6 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563832
Comment 7 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563845
Comment 8 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563852
Comment 9 by junov@chromium.org, Dec 1 2015
Blockedon: chromium:563856
Blockedon: chromium:563858
Blockedon: chromium:563861
Blockedon: chromium:563863
Blockedon: chromium:563868
Blockedon: chromium:563870
Cc: jinho.b...@samsung.com
Blockedon: chromium:565077
Status: Assigned
Blockedon: chromium:585607
I don't know if if this is a separate issue or just because it's not implemented yet; OffscreenCanvasRenderingContext2D.drawImage won't accept another OffscreenCanvas as an input.
Gives error "The provided value is not of type '(HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap)"
Comment 20 by xlai@chromium.org, Jul 27 2016
#18: Right. We haven't have a stable spec for OffscreenCanvasRenderingContext2D yet; so right now we implement most of its functions by following existing spec of HTML canvas 2d (https://html.spec.whatwg.org/multipage/scripting.html#canvasimagesource) which states the image source can be only one of the four types mentioned above.

junov@: How do you think about having OffscreenCanvas as one of the CanvasImageSource for OffscreenCanvasRenderingContext2d in the spec?


Comment 21 by junov@chromium.org, Jul 27 2016
Blockedon: 632015
Comment 22 by junov@chromium.org, Jul 27 2016
Blockedon: 632016
Comment 23 by junov@chromium.org, Jul 27 2016
Good point, I just attached two child bugs to add OffscreenCanvas to the CanvasImageSource and ImageBitmapSource IDL union types respectively.  This will allow OffscreenCanvases to be used with drawImage, createPattern and createImageBitmap.
Comment 24 by jmedley@google.com, Jul 28 2016
Is this supposed to be one of the blocking items: https://bugs.chromium.org/p/chromium/issues/detail?id=631825
Comment 25 by junov@chromium.org, Jul 28 2016
Blockedon: 631825
Good catch.
Comment 26 by xlai@chromium.org, Oct 12 2016
Blockedon: 655177
Comment 27 by xlai@chromium.org, Oct 20 2016
Blockedon: -585607
Comment 28 by xlai@chromium.org, Oct 20 2016
Blockedon: 655278
Blockedon: 655335
Blockedon: 655270
Blockedon: 658251
Comment 32 by xlai@chromium.org, Oct 25 2016
Blockedon: 659260
Comment 33 by xlai@chromium.org, Nov 2 2016
Blockedon: 661605
Comment 34 by xlai@chromium.org, Nov 4 2016
Blockedon: 662498
Blockedon: 663916
Context2D.CanvasCompositing is in the spec. Will it be implemented before launch?

https://bugs.chromium.org/p/chromium/issues/detail?id=645748
Comment 37 by junov@chromium.org, Nov 14 2016
Blockedon: 645748
Yes, compositing will be there.  Thanks for pointing it out.
Comment 38 by junov@chromium.org, Nov 14 2016
Blockedon: 665057
Comment 39 by junov@chromium.org, Nov 14 2016
Blockedon: 664547
Blockedon: 666024
Comment 41 by junov@chromium.org, Nov 30 2016
Blockedon: 669392
globalAlpha getter/setter are missing from OffscreenCanvasRenderingContext2D
@#42: Yep globalAlpha just got fix last week: https://codereview.chromium.org/2526693003/

It should be there in the latest canary build.
Blockedon: 672571
Comment 45 by junov@chromium.org, Dec 12 2016
Blockedon: 673347
Comment 46 by junov@chromium.org, Dec 12 2016
Blockedon: 673348
Project Member Comment 47 by bugdroid1@chromium.org, Dec 13 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/989e9e9435bacdc30620a2718335119791972373

commit 989e9e9435bacdc30620a2718335119791972373
Author: junov <junov@chromium.org>
Date: Tue Dec 13 19:42:22 2016

Add test to verify that OffscreenCanvas commit() retains canvas contents

BUG=563816

Review-Url: https://codereview.chromium.org/2574543002
Cr-Commit-Position: refs/heads/master@{#438258}

[add] https://crrev.com/989e9e9435bacdc30620a2718335119791972373/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-commit-retains-backing.html

Comment 48 by junov@chromium.org, Dec 16 2016
Blockedon: 646864
Comment 49 by junov@chromium.org, Dec 20 2016
Blockedon: 676131
Comment 50 by junov@chromium.org, Dec 20 2016
Blockedon: 674744
Comment 51 by xlai@chromium.org, Dec 22 2016
Blockedon: 676666
Comment 52 by xlai@chromium.org, Jan 3 2017
Blockedon: -664547
Labels: M-59
The predictability program is reviewing the top 50 starred Blink bugs this quarter, and this is #50 on that list.

Can someone give a quick summary here of the status of OffscreenCanvas?  I know work is progressing rapidly and we were originally hoping to ship in M58, right?  Is M59 now the target?

Comment 54 by xlai@chromium.org, Mar 23 2017
rbyers@: We finished most of the shipping-blocking issues for OffscreenCanvas. Now we are settling down on a spec discussion with other vendors to change the current commit() API. Once that part of spec is landed in WHATWG, as well as the implementation change + a few more conformance tests to web-platform-tests/WebGL for that change of spec, then we can ship it. I think M59 might be a bit tight a deadline; maybe M60 is a better estimate. junov@: WDYT?
Comment 55 by junov@chromium.org, Mar 23 2017
Labels: -M-59 M-60
Yeah, we are also dealing several recently discovered bugs. I think pushing to M60 is more realistic at this point. 
Comment 56 by junov@chromium.org, Mar 23 2017
Blockedon: 696223
Comment 57 by junov@chromium.org, Mar 23 2017
Blockedon: 696222
Comment 58 by junov@chromium.org, Mar 23 2017
Blockedon: 585607
Comment 59 by junov@chromium.org, Mar 23 2017
Blockedon: 697582
Comment 60 by junov@chromium.org, Mar 23 2017
Blockedon: 703673
Blockedon: 708709
Comment 62 by pacer...@gmail.com, Apr 13 2017
Am I right to say that Chrome's implementation of this will enable true offthread GPGPU?
Comment 63 by junov@chromium.org, Apr 13 2017
If you are satisfied with the OpenGL 2.0 API, then yes, this will give you offthread GPGPU. But if you want compute shaders, then you also need a next gen GPU API for the web, or a WebGL extension that exposes compute shaders.

Not sure what you mean by "true offthread", but keep in mind that the GPU itself is a monolithic resource that can only be doing one thing at a time (though that one thing may be massively parallel). So if you want your web app's UI to be interactive while it is performing a long running GPGPU task in a worker, you will have to break your GPGPU task into small chunks of work so that the GPU can interleave GPGPU work and graphics updates.
Comment 64 by junov@chromium.org, Apr 13 2017
Sorry, I meant "WebGL 2.0", not "OpenGL 2.0" in my previous comment.
Comment 65 by junov@chromium.org, Apr 26 2017
Blockedon: 715212
Comment 66 by junov@chromium.org, Apr 26 2017
Blockedon: 715757
Comment 67 by junov@chromium.org, Apr 27 2017
Blockedon: 716091
Comment 68 by junov@chromium.org, Apr 27 2017
Blockedon: 716138
Apologies if this is too off-topic, but it seems relevant to the OffscreenCanvas feature.

I've got a use case where I generate a lot of SVGs and render them to a canvas for further manipulation and extraction of ImageData. Currently this is bottlenecked on the main thread since each SVG being rendered takes ~80ms.

The only way I know of at the moment in M58 to render these SVGs is to create a Blob of the XML representation with type "image/svg+xml;charset=utf-8", then create a URL for the Blob, set the URL as the source for an Image, and after onload is finished draw the image to a CanvasRenderingContext2D.

With the work here on OffscreenCanvas will the rendering of an SVG be possible in a worker? Clearly the drawing to the canvas and further manipulation could be done in a worker thread once OffscreenCanvas is complete, but I haven't seen anything to suggest that the SVG rendering could be as well? Image is not available in the worker context, and attempting to do the rendering using createImageBitmap complains that the source Blob can't be decoded.
@69 See issue 606317
Blockedon: 718509
@69: OffscreenCanvas on its own does not completely solve the problem.  The issue pointed out in @70 is the missing link. Since DOM elements are not allowed to exist in workers the SVG cannot be loaded via HTMLImageElement. Instead we need to go through ImageBitmap. That is what issue 606317 is about.
Blockedon: 730643
Blockedon: 720188
Blockedon: 735029
Blockedon: 735228
Blockedon: 735470
Blockedon: 736022
Blockedon: 754733
Blockedon: 754736
Blockedon: 753483
Blockedon: 762647
Blockedon: 773045
Blockedon: -773045
Blockedon: 778889
Comment 86 by junov@chromium.org, Dec 6 (4 days ago)
Blockedon: 792506
Sign in to add a comment