Build and package Metal ANGLE libraries on macOS
Categories
(Core :: Graphics, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: jnicol, Assigned: jnicol)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxpe])
Attachments
(5 files)
Vendor ANGLE's Metal backend sources in to tree, build libEGL.dylib and libGLESv2.dylib, and package them.
| Assignee | ||
Comment 1•4 days ago
|
||
Selects libEGL as the target, rather than the translator. This
automatically also pulls in both libGLESv2 and the translator.
Add -Wno-unguarded-availability to mozilla_flags, allowing ANGLE's
Metal backend to compile despite using APIs too recent for Firefox's
minimum macOS version without guards.
Note that this does not set the flag for all ANGLE targets, only those
whose definition in ANGLE's GN build scripts include the flag, which
in practice is only angle_metal_backend. This is important, as it
means we can be confident that the translator, which we use on all
macOS versions, is safe to use. libEGL/libGLESv2 on the other hand,
must not be used on older macOS versions. We already ensure this is
the case by blocklisting Metal ANGLE on these macOS versions.
| Assignee | ||
Comment 2•4 days ago
|
||
This contains:
-
A patch to allow building ANGLE's Metal backend for a minimum
macOS version of 10.15. Note that it currently will only work at
runtime on macOS 12 onwards, so Firefox must ensure it does not
attempt to use ANGLE's Metal backend on older macOS versions. -
A simple copy-paste error bug fix. This has been submitted upstream,
but at time of writing has not yet been merged. -
A patch to disable compiling ANGLE's internal shaders at build-time,
which cannot currently be supported by our build system. They will
instead be compiled at runtime.
| Assignee | ||
Comment 3•4 days ago
|
||
Stay on the same base revision, but additionally pull in the required
files for the Metal backend.
| Assignee | ||
Comment 4•4 days ago
|
||
Ensure ANGLE's libEGL and libGLESv2 are packaged on macOS as well as
Windows.
Additionally update some stale comments: we've long since used ANGLE
for webrender in addition to WebGL, and as of this change it's no
longer only the D3D backend that is used.
| Assignee | ||
Comment 5•4 days ago
|
||
Now that Metal ANGLE is built and packaged on macOS, we can unblock
it. Note that it is still disabled by default, but can be enabled by
setting the pref webgl.disable-angle to false.
It remains blocked for macOS versions prior to 12 and on devices with
multiple GPUs for the time being.
Comment 8•4 days ago
|
||
Backed out for causing bustages in SystemInfo_macos.mm.
Backout link: https://hg.mozilla.org/integration/autoland/rev/295564107ffe
| Assignee | ||
Comment 9•3 days ago
|
||
Ah, gn_processor.py doesn't distinguish between macOS and iOS builds - it generates a macOS configuration then emits the moz.build files using the CONFIG["OS_TARGET"] == "Darwin" condition, which includes iOS. This means we were attempting to build the libEGL and libGLESv2 targets for iOS, but using a configuration intended for macOS, which led to attempting to include macOS-specific headers, which caused the iOS build to fail.
I had previously filed bug 2047963 about this limitation. I have worked around this for now with a bit of a kludge - replacing the CONFIG["OS_TARGET"] == "Darwin" conditions in the top-level generated moz.build file with CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa" (which is macOS specific). Since the top-level moz.build file simply adds the required targets to DIRS, this ensures we don't pull in the libEGL and libGLESv2 specific targets on iOS, and instead only build the translator targets as before.
Comment 10•3 days ago
|
||
| Assignee | ||
Updated•3 days ago
|
Updated•3 days ago
|
Comment 11•3 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/f939663fcb45
https://hg.mozilla.org/mozilla-central/rev/3ecd1bc3802f
https://hg.mozilla.org/mozilla-central/rev/8745a7ce5821
https://hg.mozilla.org/mozilla-central/rev/3869c5c274fe
https://hg.mozilla.org/mozilla-central/rev/22ee779d7a7e
Description
•