Enabling webgl2-compute support for XRWebGLLayer

143 views
Skip to first unread message

Steven Cohen

unread,
Jul 20, 2020, 12:44:05 PM7/20/20
to WebGL Dev List
I'm trying to get an application working in XR which uses a compute shader, and I discovered this bug which prevents XRWebGLLayer being created using a WebGL2ComputeRenderingContext:  https://bugs.chromium.org/p/chromium/issues/detail?id=1107256

I'm wondering if (1) this intentional or likely just an easy fix to extend the type of the allowed argument, and (2) how would I go about it if I wanted to go ahead and make this change myself?

I'm completely new to Chromium dev, but I started digging in the source and found where the V8 bindings for XRWebGLLayer are created and that it's using a generated union `WebGLRenderingContextOrWebGL2RenderingContext` from `out\Default\gen\third_party\blink\renderer\bindings\modules\v8\webgl_rendering_context_or_webgl2_rendering_context.h`. It appears however this file is generated, and I can't seem to find whats generating it. Any tips here would be greatly appreciated! 

Ken Russell

unread,
Jul 20, 2020, 1:18:41 PM7/20/20
to WebGL Dev List
Hi Steven,

Just triaged the bug you filed. While the WebGL 2.0 Compute context is experimental, and won't be shipped to the general web (WebGPU will subsume its functionality), there's no technical reason this can't be made to work.

https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/xr/xr_webgl_layer.idl;l=1?q=xr_webgl_layer.idl is the file you'd need to modify to add the "or WebGL2ComputeRenderingContext" to the typedef of XRWebGLRenderingContext. Searching through the code, there are a couple of other places that know about "WebGLRenderingContext or WebGL2RenderingContext" that also need to be generalized to the compute context.

Do you have a Chromium build setup with which to try making these changes to verify that they work?

Thanks,

-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 webgl-dev-lis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/webgl-dev-list/bd4511e1-07be-4f53-8c12-7bf9c065d1fan%40googlegroups.com.

Steven Cohen

unread,
Jul 20, 2020, 2:45:48 PM7/20/20
to WebGL Dev List
Hi Ken,

Thanks for looking into this! I did some digging and was able to get a build working with this change:  https://chromium-review.googlesource.com/c/chromium/src/+/2306913 (would have updated this thread but it wasn't visible yet :) 

That's good to know about WebGPU vs WebGL2 Compute. I was actually thinking about re-implementing my project using that API, and I was also hoping to see if I could help out with any bugs if I find them. Perhaps looking through https://bugs.chromium.org/p/chromium/issues/list?q=component%3ABlink%3EWebGPU&can=2  is a good place to start?

Kai Ninomiya

unread,
Jul 20, 2020, 3:16:51 PM7/20/20
to webgl-d...@googlegroups.com
In addition to that, check out the "helpful links" here:
for Dawn's bugtracker, mailing lists, and relevant chat rooms.

Reply all
Reply to author
Forward
0 new messages