OffscreenCanvas and SwiftShader

Skip to first unread message

Bob Blaine

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

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!


Ken Russell

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 - and it looks like this will fix this issue.

Running Chrome with SwiftShader's old OpenGL ES frontend (on macOS) via:
/Applications/Google\ Chrome\\ 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\\ 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 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.


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

Bob Blaine

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
0 new messages