ANGLE provides OpenGL ES 3.1 and EGL 1.5 libraries and tests. You can use these to build and run OpenGL ES applications on Windows, Linux, Mac and Android.
ANGLE uses git for version control. Helpful documentation can be found at http://git-scm.com/documentation.
Note: If you are building inside a Chromium checkout see these instructions instead.
Required on all platforms:
depot_toolsis in your path as it provides ninja for compilation.
download_from_google_storage --configto login to Google Storage before fetching the source.
DEPOT_TOOLS_WIN_TOOLCHAIN=0in your environment if you are not a Googler.
Individual componentstab to find the latest version.
gclient sync. Obtain this authorization via
cipd auth-loginand following the instructions.
mkdir angle cd angle fetch angle
If you're contributing code, you will also need to set up the Git
commit-msg hook. See ContributingCode#getting-started-with-gerrit for instructions.
On Linux only, you need to install all the necessary dependencies before going further by running this command:
After this completes successfully, you are ready to generate the ninja files:
gn gen out/Debug
If you had trouble checking out the code, please inspect the error message. As a reminder, on Windows, ensure you set
DEPOT_TOOLS_WIN_TOOLCHAIN=0 in your environment if you are not a Googler. If you are a Googler, ensure you ran
GN will generate ninja files. The default build options build ANGLE with clang and in release mode. Often, the default options are the desired ones, but they can be changed by running
gn args out/Debug. Some options that are commonly overriden for development are:
is_component_build = true/false (false forces static links of dependencies) target_cpu = "x64"/"x86" (the default is "x64") is_debug = true/false (use false for release builds. is_debug = true is the default) angle_assert_always_on = true/false (enables release asserts and runtime debug layers) is_clang = false (NOT RECOMMENDED) (to use system default compiler instead of clang)
For a release build run
gn args out/Release and set
is_debug = false. Optionally set
angle_assert_always_on = true for Release testing.
On Windows, you can build for the Universal Windows Platform (UWP) by setting
target_os = "winuwp" in the args. Setting
is_component_build = false is highly recommended to support moving libEGL.dll and libGLESv2.dll to an application's directory and being self-contained, instead of depending on other DLLs (d3dcompiler_47.dll is still needed for the Direct3D backend). We also recommend using
is_clang = false with UWP.
For more information on GN run
autoninja to compile on all platforms with one of the following commands:
autoninja -C out/Debug autoninja -C out/Release
autoninja, so it should be available in your path from earlier steps. Ninja automatically calls GN to regenerate the build files on any configuration change.
autoninja automatically specifies a thread count to
ninja based on your system configuration.
In addition, we highly recommend Google employees use goma, a distributed compilation system. Detailed information is available internally. To enable Goma set the GN arg:
use_goma = true
To generate the Visual Studio solution in
gn gen out/Debug --sln=angle-debug --ide=vs2022 --ninja-executable="C:\src\angle\third_party\ninja\ninja.exe"
In Visual Studio:
autoninjafrom a command line to build manually.
Once the build completes, all ANGLE libraries, tests, and samples will be located in
See the Android specific documentation.
This sections describes how to use ANGLE to build an OpenGL ES application.
ANGLE can use a variety of backing renderers based on platform. On Windows, it defaults to D3D11 where it's available, or D3D9 otherwise. On other desktop platforms, it defaults to GL. On mobile, it defaults to GLES.
ANGLE provides an EGL extension called
EGL_ANGLE_platform_angle which allows uers to select which renderer to use at EGL initialization time by calling eglGetPlatformDisplayEXT with special enums. Details of the extension can be found in its specification in
extensions/EGL_ANGLE_platform_angle_*.txt and examples of its use can be seen in the ANGLE samples and tests, particularly
To change the default D3D backend:
ANGLE_DEFAULT_D3D11near the head of the file, and set it to your preference.
To remove any backend entirely:
gn args <path/to/build/dir>
false. Options are:
includefolder to provide access to the standard Khronos EGL and GLES2 header files.
libGLESv2.libfound in the build output directory (see Building ANGLE).
libGLESv2.libfile to Additional Dependencies, separated by a semicolon.
libGLESv2.dllfrom the build output directory (see Building ANGLE) into your application folder.
On Linux and MacOS, either:
dlopento load the OpenGL ES and EGL entry points at runtime.
In addition to OpenGL ES and EGL libraries, ANGLE also provides a GLSL ES translator. The translator targets various back-ends, including HLSL, GLSL for desktop and mobile, SPIR-V and Metal SL. To build the translator, build the
angle_shader_translator target. Run the translator binary without arguments to see a usage message.
The translator code is included with ANGLE but fully independent; it resides in
src/compiler. Follow the steps above for getting and building ANGLE to build the translator on the platform of your choice.
shader_translator sample demos basic C++ API usage. To translate a GLSL ES shader, call the following functions in the same order:
sh::Initialize()initializes the translator library and must be called only once from each process using the translator.
sh::ContructCompiler()creates a translator object for vertex or fragment shader.
sh::Compile()translates the given shader.
sh::Destruct()destroys the given translator.
sh::Finalize()shuts down the translator library and must be called only once from each process using the translator.