#angle #opengl #mozilla #es #fork #build #google

mozangle

Mozilla's fork of Google ANGLE, repackaged as a Rust crate

26 releases

Uses old Rust 2015

0.5.1 Feb 9, 2024
0.5.0 Dec 7, 2023
0.4.0 Oct 11, 2023
0.3.5 Jul 1, 2023
0.1.6 Mar 15, 2018

#76 in Graphics APIs

Download history 627/week @ 2023-12-06 369/week @ 2023-12-13 705/week @ 2023-12-20 519/week @ 2023-12-27 881/week @ 2024-01-03 722/week @ 2024-01-10 961/week @ 2024-01-17 1183/week @ 2024-01-24 848/week @ 2024-01-31 1123/week @ 2024-02-07 1241/week @ 2024-02-14 999/week @ 2024-02-21 1511/week @ 2024-02-28 1941/week @ 2024-03-06 1914/week @ 2024-03-13 1796/week @ 2024-03-20

7,306 downloads per month
Used in 4 crates

BSD-3-Clause

14MB
306K SLoC

C++ 296K SLoC // 0.0% comments C 4K SLoC // 0.1% comments Bitbake 3.5K SLoC // 0.0% comments Rust 1.5K SLoC // 0.0% comments Python 551 SLoC // 0.2% comments Shell 53 SLoC // 0.2% comments

mozangle

Mozilla's fork of Google ANGLE, repackaged as a Rust crate.

  • ANGLE is an implementation of OpenGL ES. Its official build system is gn, from Chromium's depot_tools.

  • mozilla/angle on GitHub is a fork with some Gecko-specific patches.

  • gfx/angle in mozilla-central is generated from that. update-angle.py runs gn desc to extract information from the official build system, copies relevant source files, and creates moz.build files for Gecko's build system.

  • This repository imports a copy of the gfx/angle directory. The generate_build_data.py script turns data from moz.build files into a Rust source file. (This script supports just enough of the moz.build format for this specific purpose.) Finally, a Cargo build script drives the C++ compilation with the cc crate based on that data.

Feature flags

By default, this crate only compiles the shader translator.

In Windows, the egl Cargo feature enables the EGL and OpenGL ES implementations. Although upstream ANGLE supports more platforms, this crate only configures the Direct3D 11 rendering backend.

[dependencies]
mozangle = { version = "0.5", features = ["egl"] }

Updating ANGLE

To update:

  • Remove gfx/angle entirely
  • Copy a new version of it from mozilla-central
  • Apply any patches present in the patches directory
  • Run python3 generate_build_data.py
  • In the commit message, include the mozilla-central commit hash

Dependencies

~0–4MB
~65K SLoC