Help understanding (WebGL) extension mechanism?

This has relatively little to do with Babylon.js but I am hoping the community can spare me a post on SO and the hostile feedback that usually goes with that exercise…

If I open the default Playground and add to access the Inspector, the Statistics tab gives me slightly different info in Chrome and Firefox.

In particular, parallel shader compilation is reported to be available in Chrome, but not in Firefox. A quick look at the code base seems to indicate that KHR_parallel_shader_compile must be enabled for this.

I understand that different browsers implement WebGL differently. What confuses me is that this KHR extension is listed in FF about:support, under WebGL 2 Driver Extensions. So I would expect it to be enabled.

Am I misunderstanding how extensions work and are reported in the browser? If so, could someone shed some light on the extension mechanism? (What can cause them to be listed as installed, but yet be unavailable? How to systematically identify browser settings that might interfere with availability, etc.?)


1 Like

Hi @jbl

I can’t answer the question you asked, so hopefully someone else can step in for that.

But I just wanted to point out that you don’t need to add in code to open the inspector in the playground - there’s an icon for it in the toolbar:


Thanks for the tip @inteja :slight_smile:

Hey @jbl ! Thanks for bringing this to our attention! It appears the extension can be listed as either of two names, KHR_parallel_shader_compile or *GL_*KHR_parallel_shader_compile, and we were only checking the former. Will open a PR!

EDIT: It appears I had a case of Open/WebGL mixup here, sorry! So, there are two “different” extension names:

KHR_parallel_shader_compile, which applies to the WebGL specification,

and GL_KHR_parallel_shader_compile, which applies to the OpenGL specification.

Looking at all the “WebGL 2 Driver Extensions” tab, it shows only extensions with the GL_ prefix, so it seems that these are the driver’s underlying OpenGL extensions, not the ones available on WebGL. The nomenclature here is definitely a tad confusing. :sweat_smile:


Thanks @carolhmj for looking into this!

After a long detour and a deep dive into *GL extensions (to better understand how Basis Universal compressed GPU textures are handled in different environments), I took a fresh look at my KHR_parallel_shader_compile issue today, and at your answer.

Confusing nomenclature indeed! :slight_smile:

What you write makes perfect sense though, and the presence of a “WebGL * Extensions” section right next to each “WebGL * Driver Extensions” section should have been a red flag.

In fact, the extensions listed under “WebGL 2 Driver Extensions” are the same returned by gl.getSupportedExtensions() (with the exception of MOZ_debug). And in my environment, KHR_parallel_shader_compile is not on the list.

Chrome on the other hand, seems to only list in chrome://gpu/ the extensions supported by the driver. As I could find GL_KHR_parallel_shader_compile listed there, I assumed wrongly that if the browser reports (driver) support for GL_KHR_parallel_shader_compile, that is sufficient to guarantee browser support.

And to add to the confusion… Caniuse reports that the extension should be available in Firefox since v80. But guess what? This info is incorrect, and there is an open issue about it!

Phew… :sweat_smile: