WebGPU error catching when rendering on worker

98 views
Skip to first unread message

wenhan chong

unread,
Jul 30, 2023, 2:54:10 PM7/30/23
to blink-dev
Hi All,

I am trying to use WebGPU uncapturederror listener to detect unexpected errors that happen during render time. I notice that errors are suppressed and not captured when I am rendering to an offscreen canvas on a worker. I tested this by forcing a simple GPUValidationError in the shaders. On an app that renders directly on the main thread, I am able to catch the error. However, on an app that renders to an offscreen canvas on a worker thread before transferring to main, the error is not captured. There is also no console output indicating any errors without the use of the uncapturederror listener. The canvas simply doesn't render. Is this a known issue and is there a workaround?

Thanks,
Wen Han

Brandon Jones

unread,
Jul 31, 2023, 2:50:15 PM7/31/23
to wenhan chong, blink-dev
Hi Wenhan!

I [wrote a quick test](https://codepen.io/toji/pen/ZEmVypz) to try this out and I'm able to see the uncapturederror events in the worker and forward them on to the main thread for logging.

Is there a reduced version of the code that's producing the issue that you could share? Because otherwise it looks like it's working in at least this trivial case.

--Brandon 

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/2ff4f166-182e-46bb-bedd-9145dd2b675dn%40chromium.org.

wenhan chong

unread,
Aug 3, 2023, 10:03:56 AM8/3/23
to blink-dev, Brandon Jones, blink-dev, wenhan chong
Hi Brandon,

Thanks for looking at this. I compared you sample code against the code in my app and saw that the render loop on my worker thread was causing the issue. It seems that having a render loop on the worker prevents control from returning to the ui thread, thus suppressing any errors thrown by webgpu device. I was able to use the uncapturederror event listener after removing the loop.

Thanks,
Wen Han

Brandon Jones

unread,
Aug 3, 2023, 11:58:32 AM8/3/23
to wenhan chong, blink-dev
Glad that you were able to figure it out! And yeah, that can be a non-obvious requirement of operating in a worker. I'll see if there's any sensible places for us to surface that to the rest of the community.

--Brandon
Reply all
Reply to author
Forward
0 new messages