Open Bug 1736076 Opened 4 years ago Updated 6 days ago

Support WebGL extension KHR_parallel_shader_compile

Categories

(Core :: Graphics: CanvasWebGL, enhancement)

Firefox 95
Desktop
All
enhancement

Tracking

()

Tracking Status
firefox95 --- affected

People

(Reporter: rverschelde, Assigned: bradwerth, NeedInfo)

References

(Blocks 3 open bugs)

Details

(4 keywords, Whiteboard: [platform-feature])

User Story

web-feature: khr-parallel-shader-compile
user-impact-score:90

Attachments

(1 file, 2 obsolete files)

According to MDN, the KHR_parallel_shader_compile WebGL 1.0 extension should be supported in Firefox 80+ on desktop.

Yet websites such as WebGL Caps Viewer don't list it, and my application Godot Engine is unable to use it to compile shaders in parallel. It is however reported as supported and working fine with latest Chrome and Chromium.

I tested both on Windows and Linux, with both Intel and AMD drivers (Linux system details listed below), and neither combination seems to expose KHR_parallel_shader_compile in Firefox. I've had multiple users confirm the same issue on both Windows and Linux (though I don't know with which GPU drivers, if that's relevant to the availability of the extension).

I tried enabling webgl.enable-draft-extensions and webgl.enable-privileged-extensions but that doesn't change the result.

The feature implementation was tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=1536674, but it seems the resolution was a patch that added the extension to the enum, but no actual code to implement it? https://phabricator.services.mozilla.com/D32056

So is MDN incorrect and the extension is actually not supported in Firefox currently?

I tested on current Nightly (95) and release (93). I tried FF 80 but it seems broken on my Linux system, but I had one teammate test and confirm that the extension is also not present there.

$ inxi -CSG
System:    Host: cauldron Kernel: 5.14.12-desktop-2.mga9 x86_64 bits: 64 Desktop: KDE Plasma 5.22.3 Distro: Mageia 9 mga9 
CPU:       Info: Quad Core model: Intel Core i7-8705G bits: 64 type: MT MCP cache: L2: 8 MiB 
           Speed: 3066 MHz min/max: 800/3100 MHz Core speeds (MHz): 1: 3066 2: 3100 3: 3100 4: 3091 5: 3098 6: 2955 7: 3029 
           8: 3025 
Graphics:  Device-1: Intel HD Graphics 630 driver: i915 v: kernel 
           Device-2: Advanced Micro Devices [AMD/ATI] Polaris 22 XL [Radeon RX Vega M GL] driver: amdgpu v: kernel 
           Device-3: Cheng Uei Precision Industry (Foxlink) HP Wide Vision FHD Camera type: USB driver: uvcvideo 
           Display: x11 server: Mageia X.org 1.21.0.99 driver: loaded: intel,v4l resolution: 1920x1080~100Hz 
           OpenGL: renderer: Mesa Intel HD Graphics 630 (KBL GT2) v: 4.6 Mesa 21.2.4

(In reply to Rémi Verschelde from comment #0)

The feature implementation was tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=1536674, but it seems the resolution was a patch that added the extension to the enum, but no actual code to implement it? https://phabricator.services.mozilla.com/D32056

Sorry about that, I had reviewed the bug a bit too quickly, there are links to various intermediate patches which implement the feature.

So on second review, it seems to me that https://bugzilla.mozilla.org/show_bug.cgi?id=1536674 was wrongly closed as fixed by https://hg.mozilla.org/mozilla-central/rev/c534308b0e49 in https://bugzilla.mozilla.org/show_bug.cgi?id=1536674#c5

The actual implementation of the draft extension seems to be https://phabricator.services.mozilla.com/D83315#change-9IYWqbnfEgqP linked in https://bugzilla.mozilla.org/show_bug.cgi?id=1536674#c6, which has yet to be merged in trunk.

So MDN should be updated to remove the reference that FF supports the extension since version 80, likewise with https://caniuse.com/mdn-api_khr_parallel_shader_compile and other similar references.

And https://bugzilla.mozilla.org/show_bug.cgi?id=1536674 should probably be reopened.

Hi Rémi,

Thanks for your report and for providing information about it.
I'll be setting up a component so the Core WebGL team can take a look and advice.

Regards,
Virginia

Component: General → Canvas: WebGL
Product: Firefox → Core

I'm happy to update MDN with the relevant information. Do we have an indication of when this will be merged in trunk? The version associated with this bug is 95 - should I go with that? Thanks

The severity field is not set for this bug.
:jgilbert, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jgilbert)

Seems like I can't reopen bug 1536674, so I'll rename it I guess?

Flags: needinfo?(jgilbert)
Type: defect → enhancement

Can you please confirm the only change from this is that the Firefox compatibility with version 80 needs to be set as false? This is done in https://github.com/mdn/browser-compat-data/pull/13291

Flags: needinfo?(jgilbert)

Correct.

Flags: needinfo?(jgilbert)

The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true

I guess we can use this as the tracking bug for whatever's needed to land and ship the support.

User Story: (updated)
Summary: WebGL extension KHR_parallel_shader_compile doesn't appear to be supported → Support WebGL extension KHR_parallel_shader_compile
Whiteboard: [platform-feature]

It would really be great to have KHR_parallel_shader_compile supported in Firefox. In my application, Mol*, we would be able to avoid blocking user input for multiple seconds. The extension works great in other Browsers.

We should do this..

Flags: needinfo?(ahale)

I'll see if I can do this by reviving the patches in Bug 1536674.

Assignee: nobody → bwerth
Duplicate of this bug: 2001461

Google is updating how we render maps on the web to support future improvements, and we've launched our new renderer on Chrome. Supporting this extension would go a long way towards allowing us to bring the new renderer to Firefox.

User Story: (updated)

Jeff M developing the patch.

Assignee: bwerth → jmuizelaar
User Story: (updated)
Flags: needinfo?(ahale)
See Also: → 2027952

Jeff, is this ready to land?

Flags: needinfo?(jmuizelaar)

(In reply to Brad Werth [:bradwerth] from comment #18)

Jeff, is this ready to land?

Probably not. I only rebased the patch. I haven't tested it.

Flags: needinfo?(jmuizelaar)

Carries forward the rebased patch in D289914 by Jeff Muizelaar.

Delta from that revision:

  • Replace incorrect Run<RPROC(...)> sync-IPC calls with the Send...
    pattern + new sync IPDL messages (CompileCompleted, LinkCompleted)
    and matching Recv handlers in WebGLParent.
  • Register the new sync messages in ipc/ipdl/sync-messages.ini.
  • Return true for COMPLETION_STATUS_KHR queries on a lost context,
    per the KHR_parallel_shader_compile spec.
  • Add the spec link in WebGLRenderingContext.webidl per smaug's review.
Attachment #9591004 - Attachment description: Bug 1736076 - Support WebGL extension KHR_parallel_shader_compile. r?ahale,smaug → WIP: Bug 1736076 - Support WebGL extension KHR_parallel_shader_compile.
Blocks: 2016057

I'll take this Bug as I try to finish up the patches.

Assignee: jmuizelaar → bwerth
User Story: (updated)
Attachment #9558326 - Attachment is obsolete: true

(In reply to Brad Werth [:bradwerth] from comment #21)

We'll use https://registry.khronos.org/webgl/sdk/tests/conformance/extensions/khr-parallel-shader-compile.html?webglVersion=2&quiet=0&quick=1 as a test.

This conformance test shows 2 failures:

FAIL Querying shader status should not wait for compilation. Took 485 ms
FAIL Program should have taken many more than 6 frames to compile. Actual value: 2 frames, duration 730 ms.

The call to gl.getShaderParameter needs to complete in less than 100ms to pass this test. I'll figure out where the slowdown is.

This is a profile of a DEBUG BUILD reloading the khronos test page. Might be useful figuring out which GL calls are contributing to the failed test.

User Story: (updated)

That profile doesn't have URLs which makes it harder to figure out what's going on

I'd also suggest getting a profile with flows feature turned on.

Yeah, that profile clearly shows us getting stuck in the content process on sync ipc:
https://share.firefox.dev/4fKle2t

Attachment #9591004 - Attachment description: WIP: Bug 1736076 - Support WebGL extension KHR_parallel_shader_compile. → WIP: Bug 1736076 Part 1: Implement API for WebGL extension KHR_parallel_shader_compile.

This patch adds the necessary pieces for KHR_parallel_shader_compile
when that extension is not actually available from the GL context.

If this approach is acceptable, the shim should be gated by a pref.

Attachment #9598589 - Attachment is obsolete: true
Attachment #9591004 - Attachment description: WIP: Bug 1736076 Part 1: Implement API for WebGL extension KHR_parallel_shader_compile. → Bug 1736076 Part 1: Implement API for WebGL extension KHR_parallel_shader_compile.
Depends on: 1908744

Patches have landed for bug 1908744, with an update to ANGLE that's been waiting for years. I believe dependencies for this are unblocked now. Is that right, :bwerth?

Flags: needinfo?(bwerth)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: