kc3-lang/angle/doc/DevSetup.md

Download

ANGLE Development

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.

Development setup

Version Control

ANGLE uses git for version control. Helpful documentation can be found at http://git-scm.com/documentation.

Required Tools

On all platforms:

On Windows:

On Linux:

On MacOS:

Getting the source

git clone https://chromium.googlesource.com/angle/angle
cd angle
python scripts/bootstrap.py
gclient sync
git checkout main

On Linux only, you need to install all the necessary dependencies before going further by running this command:

./build/install-build-deps.sh

After this completes successfully, you are ready to generate the ninja files:

gn gen out/Debug

On Windows only, ensure you set DEPOT_TOOLS_WIN_TOOLCHAIN=0 in your environment (if you are not a Googler).

GN will generate ninja files. To change the default build options run gn args out/Debug. Some commonly used options are:

target_cpu = "x86"              (default is "x64")
is_clang = false                (to use system default compiler instead of clang)
is_debug = false                (for release builds. is_debug = true is the default)
angle_assert_always_on = true   (enable release asserts and debug layers)

For a release build run gn args out/Release and set is_debug = false.

On Windows, you can build for the Universal Windows Platform (UWP) by setting target_os = "winuwp" in the args.

For more information on GN run gn help.

Ninja can be used to compile on all platforms with one of the following commands:

autoninja -C out/Debug
autoninja -C out/Release

Ninja automatically calls GN to regenerate the build files on any configuration change.

Ensure depot_tools is in your path as it provides ninja.

Building with Goma (Google employees only)

In addition, Google employees should use goma, a distributed compilation system. Detailed information is available internally but the relevant gn arg is:

use_goma = true

To get any benefit from goma it is important to pass a large -j value to ninja. A good default is 10numCores to 20numCores. If you run autoninja then it will automatically pass an appropriate -j value to ninja for goma or not.

$ autoninja -C out\Debug

Building and Debugging with Visual Studio

To generate the Visual Studio solution in out/Debug/angle-debug.sln:

gn gen out/Debug --sln=angle-debug --ide=vs2019

In Visual Studio:

  1. Open the ANGLE solution file out/Debug/angle-debug.sln.
  2. It is recommended you still use autoninja from the command line to build.
  3. If you do want to build in the solution, “Build Solution” is not functional with GN. Build one target at a time.

Once the build completes all ANGLE libraries, tests, and samples will be located in out/Debug.

Building ANGLE for Android

See the Android specific documentation.

Application Development with ANGLE

This sections describes how to use ANGLE to build an OpenGL ES application.

Choosing a Backend

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 extensions/EGL_ANGLE_platform_angle_*.txt and examples of its use can be seen in the ANGLE samples and tests, particularly util/EGLWindow.cpp.

To change the default D3D backend:

  1. Open src/libANGLE/renderer/d3d/DisplayD3D.cpp
  2. Locate the definition of ANGLE_DEFAULT_D3D11 near the head of the file, and set it to your preference.

To remove any backend entirely:

  1. Run gn args <path/to/build/dir>
  2. Set the appropriate variable to false. Options are:

To Use ANGLE in Your Application

On Windows:

  1. Configure your build environment to have access to the include folder to provide access to the standard Khronos EGL and GLES2 header files.
  1. Configure your build environment to have access to libEGL.lib and libGLESv2.lib found in the build output directory (see Building ANGLE).
  1. Copy libEGL.dll and libGLESv2.dll from the build output directory (see Building ANGLE) into your application folder.
  2. Code your application to the Khronos OpenGL ES 2.0 and EGL 1.4 APIs.

On Linux and MacOS, either:

GLSL ES to GLSL Translator

In addition to OpenGL ES 2.0 and EGL 1.4 libraries, ANGLE also provides a GLSL ES to GLSL translator. This is useful for implementing OpenGL ES emulators on top of desktop OpenGL.

Source and Building

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.

Usage

The basic usage is shown in essl_to_glsl sample under samples/translator. To translate a GLSL ES shader, following functions need to be called in the same order:


Source

Download