Bug 209809

Summary: Add WebGL(2) context support to OffscreenCanvas
Product: WebKit Reporter: Chris Lord <clord>
Component: CanvasAssignee: Chris Lord <clord>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, clopez, darin, dino, esprehn+autocc, ews-watchlist, graouts, gyuyoung.kim, hi, kbr, kondapallykalyan, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 202797    
Bug Blocks: 183720    
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Lord 2020-03-31 07:52:34 PDT
After bug 202797, OffscreenCanvas works with 2d canvas contexts (minus text functions), but does not work for WebGL contexts. A lot of the WebGL code assumes an HTMLCanvasElement (mostly unnecessarily) - this bug covers the work needed to have it work with an OffscreenCanvas.
Comment 1 Chris Lord 2020-08-27 01:30:42 PDT
Created attachment 407383 [details]
Patch
Comment 2 Chris Lord 2020-08-27 01:31:39 PDT
(In reply to Chris Lord from comment #0)
> After bug 202797, OffscreenCanvas works with 2d canvas contexts (minus text
> functions), but does not work for WebGL contexts. A lot of the WebGL code
> assumes an HTMLCanvasElement (mostly unnecessarily) - this bug covers the
> work needed to have it work with an OffscreenCanvas.

Far less than I thought actually, I'd made some wrong assumptions on an initial read of the code.
Comment 3 Kenneth Russell 2020-08-27 13:32:26 PDT
Comment on attachment 407383 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407383&action=review

Exciting to see this support being integrated! One small question.

> LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext-expected.txt:3
> +FAIL Test that getContext with supported string returns correct results Can't find variable: WebGL2RenderingContext

Is this particular failure mode expected? Does this mean that WebGL2RenderingContext wasn't properly exposed on a worker context?
Comment 4 Chris Lord 2020-08-28 00:43:17 PDT
(In reply to Kenneth Russell from comment #3)
> Comment on attachment 407383 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=407383&action=review
> 
> Exciting to see this support being integrated! One small question.
> 
> > LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext-expected.txt:3
> > +FAIL Test that getContext with supported string returns correct results Can't find variable: WebGL2RenderingContext
> 
> Is this particular failure mode expected? Does this mean that
> WebGL2RenderingContext wasn't properly exposed on a worker context?

This is just because WebGL2 requires ANGLE, which isn't used (by default? yet?) on WPE/GTK - this ought to work on Mac, but I don't have one to test that.
Comment 5 Chris Lord 2020-08-28 01:06:48 PDT
Created attachment 407454 [details]
Patch
Comment 6 EWS 2020-08-28 01:46:50 PDT
Committed r266275: <https://trac.webkit.org/changeset/266275>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407454 [details].
Comment 7 Radar WebKit Bug Importer 2020-08-28 01:47:13 PDT
<rdar://problem/67927342>