Closed Bug 2045041 Opened 1 month ago Closed 1 month ago

Require GLSL version >= 150 for WebGL

Categories

(Core :: Graphics, task)

task

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox153 --- fixed

People

(Reporter: jnicol, Assigned: jnicol)

References

Details

Attachments

(2 files)

Upstream ANGLE has removed shader translator output support for GLSL versions < 150. (GLSL version 150 corresponds to GL version 3.2).

When we next update ANGLE in bug 1908744, this means we can no longer support WebGL on contexts using older GLSL versions. In practice this is probably a small, but not non-existent, proportion of our users. At least in some cases we should still be able to support WebGL 1 for some of these users by preferring to give them an ES 2 context over a pre-3.2 desktop context.

I think we might as well make this change now in advance of the impending ANGLE update, and see what fallout there is, if any.

My intended plan for this is:

  • Remove the pref webgl.1.allow-core-profiles. Currently true on macos and false elsewhere.
  • Instead, act as if the pref was true, i.e. do not set REQUIRE_COMPAT_PROFILE here
  • Retain the gfxVar that can still set REQUIRE_COMPAT_PROFILE just below. In practice this is only used for Intel HD Graphics 3000 on OSX (bug 1413269), which as far as I can tell cannot run a recent enough OS to run firefox. But it seems safer to keep this just in case.
  • The absence of REQUIRE_COMPAT_PROFILE will ensure our GLContextProvider impls request a 3.2 core context
  • If this fails, GLContextProviderEGL at least will fallback to attempting to create a GLES 2 context.
  • If this fails, we're out of luck.

WebGLContext::InitAndValidateGL() should then check the GLSL version for desktop GL contexts and validate it's high enough.

One consequence of this is that when running WebGL 1 on drivers that do in fact support GL 3.2 onwards, we will now request and receive a core context rather than a compatibility context. e.g. on my linux computer I currently get 4.6 (Compatibility Profile) Mesa 25.3.6, and would instead get 4.6 (Core Profile) Mesa 25.3.6. In theory I don't think this should make any difference, but in practice I guess could uncover driver bugs. Let's see.

Upstream ANGLE has dropped support for shader translator output
targetting GLSL versions lower than 150. In preparation for the
upcoming ANGLE update, this patch blocks WebGL when the supported GLSL
version is too low. Additionally it removes references to the
soon-to-be-removed ShShaderOutput values when creating the shader
validator, which is required to compile when we next update ANGLE.

Assignee: nobody → jnicol
Status: NEW → ASSIGNED

In anticipation of the next ANGLE update, which will drop support for
shader translator output targetting GLSL versions lower than 150, we
now require a desktop GL context version of 3.2+ to run WebGL. This
means we should avoid setting the REQUIRE_COMPAT_PROFILE flag, as it
only requests a context version of 2.0.

This patch therefore removes the webgl.1.allow-core-profiles pref, and
instead always requests a core context. A consequence of this is that
we will now request core contexts even when the driver does in fact
support compat contexts of a sufficient version, but this should be
harmless.

When a driver does not support desktop GL 3.2, on EGL we will fall
back to attempting to create a GLES 2 context, which may still allow
users to run WebGL 1 on certain hardware.

As a precaution, the WebglAllowCoreProfile gfxVar is retained, which
is used to prevent us creating core contexts on buggy devices. If
this var were to be set false, a compat context would be succesfully
created, but WebGL would be blocked if the supported GLSL version is
insufficient (which would be preferable to creating a core context and
subsequently crashing). In practice, this is currently only set false
on old Mac hardware which is no longer supported.

Pushed by jnicol@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/122b6a1549ae https://hg.mozilla.org/integration/autoland/rev/b09b207dd3ed Require GL_SHADING_LANGUAGE_VERSION >= 150 on desktop GL contexts for WebGL. r=gfx-reviewers,lsalzman https://github.com/mozilla-firefox/firefox/commit/ddd240668eae https://hg.mozilla.org/integration/autoland/rev/c8e83575beba Avoid creating compat profile GL contexts for WebGL 1. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: