OffscreenCanvas and SwiftShader

30 views
Skip to first unread message

Bob Blaine

unread,
May 25, 2021, 6:51:46 PM5/25/21
to WebGL Dev List
Hi,

Not sure if this question is for WebGL Dev or Graphics-Dev, sorry if I picked wrong. I'm trying to set up a way to draw WebGL offscreen and then present the image in an onscreen canvas. 
I've been pretty successful using the OffscreenCanvas and a bitmaprenderer context combination when hardware graphics is available, but if I happen to get SwiftShader to implement WebGL, I get a blank screen. I think I'm using the code suggested by MDN for this and I don't seem to be getting any indication that what I'm doing is wrong or unavailable. I do get a display if I switch to using an HTML canvas (unattached to the DOM), and an HTML canvas with a 2d context attached to the DOM, though this implementation is slower than the OffscreenCanvas and I'd like to not have to use it when the OffscreenCanvas works. Unfortunately, since there is no indication that when using SwiftShader the OffscreenCanvas implementation isn't going to work, and it gets really cumbersome to switch.

I haven't tried mixing bitmaprenderer onscreen with and unattached HTML canvas or visa versa.

I've attached both examples. Am I doing something wrong, or missing something? 

Thanks in advance!


webgl_2D_Canvas.html
webgl_OffscreenCanvas.html

Ken Russell

unread,
May 25, 2021, 8:47:05 PM5/25/21
to WebGL Dev List
Hi Bob,

Somewhat good news - a major revision to SwiftShader is underway - see http://crbug.com/1209250 - and it looks like this will fix this issue.

Running Chrome with SwiftShader's old OpenGL ES frontend (on macOS) via:
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --user-data-dir=/tmp/c1 --disable-gpu

your 2D canvas example renders correctly but not the OffscreenCanvas version.

However, with SwiftShader's new Vulkan frontend:
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --user-data-dir=/tmp/c1 --use-cmd-decoder=passthrough --use-angle=swiftshader-webgl

the OffscreenCanvas version renders correctly.

This is still in development, and there are some bugs - I've just filed http://crbug.com/1213277 about them.

Please post again if you see more problems, and feel free to file bugs against Chrome yourself - please post the bug IDs on this list if you do, so our team can make sure to see them.

-Ken



--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/webgl-dev-list/46221eb7-8b43-4155-b3e4-a0fb9f1eead3n%40googlegroups.com.

Bob Blaine

unread,
Jun 2, 2021, 4:31:32 PM6/2/21
to WebGL Dev List
Thanks, Ken, this is good news. 
Also, thanks for the link to the Chrome bugs!

Reply all
Reply to author
Forward
0 new messages