1*8975f5c5SAndroid Build Coastguard Worker# ANGLE Orientation 2*8975f5c5SAndroid Build Coastguard Worker 3*8975f5c5SAndroid Build Coastguard WorkerA basic guide to get up and running fixing bugs and performance issues in ANGLE. 4*8975f5c5SAndroid Build Coastguard Worker 5*8975f5c5SAndroid Build Coastguard Worker## First ANGLE Compile 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Worker### Windows 8*8975f5c5SAndroid Build Coastguard Worker 9*8975f5c5SAndroid Build Coastguard Worker- Download and install 10*8975f5c5SAndroid Build Coastguard Worker [Visual Studio Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx). 11*8975f5c5SAndroid Build Coastguard Worker Installing takes some time. 12*8975f5c5SAndroid Build Coastguard Worker 13*8975f5c5SAndroid Build Coastguard Worker- Take the time to register a Microsoft account, otherwise you'll get nagged to death. 14*8975f5c5SAndroid Build Coastguard Worker 15*8975f5c5SAndroid Build Coastguard Worker- Download and install Chromium's 16*8975f5c5SAndroid Build Coastguard Worker [depot_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) 17*8975f5c5SAndroid Build Coastguard Worker for building ANGLE. 18*8975f5c5SAndroid Build Coastguard Worker 19*8975f5c5SAndroid Build Coastguard Worker- Add the `depot_tools` dir to your system path. Open start menu, type "edit environment variables", 20*8975f5c5SAndroid Build Coastguard Worker add it to PATH. 21*8975f5c5SAndroid Build Coastguard Worker 22*8975f5c5SAndroid Build Coastguard Worker- (recommended) Download and install [Git for Windows](http://gitforwindows.org/). 23*8975f5c5SAndroid Build Coastguard Worker 24*8975f5c5SAndroid Build Coastguard Worker- Open Git bash, head to C:/src and follow the steps on 25*8975f5c5SAndroid Build Coastguard Worker [the ANGLE wiki](https://chromium.googlesource.com/angle/angle/+/main/doc/DevSetup.md#Development-setup-Getting-the-source) 26*8975f5c5SAndroid Build Coastguard Worker to set up the ANGLE solution for the first time. 27*8975f5c5SAndroid Build Coastguard Worker 28*8975f5c5SAndroid Build Coastguard Worker- If you follow the [ANGLE wiki VS solution building and debugging guide](https://chromium.googlesource.com/angle/angle/+/main/doc/DevSetup.md#building-and-debugging-with-visual-studio), the VS solution will be in `c:/src/angle/out/Debug/angle-debug.sln`. Open and let the installation 29*8975f5c5SAndroid Build Coastguard Worker finish. **Important**: set indent style to spaces, not tabs! 30*8975f5c5SAndroid Build Coastguard Worker 31*8975f5c5SAndroid Build Coastguard Worker- Building should work at this point! 32*8975f5c5SAndroid Build Coastguard Worker 33*8975f5c5SAndroid Build Coastguard Worker- Try running `angle_end2end_tests`, `angle_unittests` or a sample program. 34*8975f5c5SAndroid Build Coastguard Worker 35*8975f5c5SAndroid Build Coastguard Worker- Useful VS extensions: 36*8975f5c5SAndroid Build Coastguard Worker 37*8975f5c5SAndroid Build Coastguard Worker 1. [Build Only Startup Project](https://marketplace.visualstudio.com/items?itemName=SenHarada.BuildOnlyStartupProject) 38*8975f5c5SAndroid Build Coastguard Worker 2. [SwitchStartupProject](https://marketplace.visualstudio.com/items?itemName=vs-publisher-141975.SwitchStartupProject) 39*8975f5c5SAndroid Build Coastguard Worker 3. [Smart CommandLine Arguments](https://www.visualstudiogallery.msdn.microsoft.com/535f79b1-fbe0-4b0a-a346-8cdf271ea071) 40*8975f5c5SAndroid Build Coastguard Worker 41*8975f5c5SAndroid Build Coastguard Worker### Linux 42*8975f5c5SAndroid Build Coastguard Worker 43*8975f5c5SAndroid Build Coastguard Worker- Download and install Chromium's 44*8975f5c5SAndroid Build Coastguard Worker [depot_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) 45*8975f5c5SAndroid Build Coastguard Worker for building ANGLE. 46*8975f5c5SAndroid Build Coastguard Worker 47*8975f5c5SAndroid Build Coastguard Worker- Ensure you add `depot_tools` to your bashrc as in the wiki link above. 48*8975f5c5SAndroid Build Coastguard Worker 49*8975f5c5SAndroid Build Coastguard Worker- Follow the steps on 50*8975f5c5SAndroid Build Coastguard Worker [the ANGLE wiki](https://chromium.googlesource.com/angle/angle/+/main/doc/DevSetup.md#Development-setup-Getting-the-source) 51*8975f5c5SAndroid Build Coastguard Worker to setup ANGLE's build. 52*8975f5c5SAndroid Build Coastguard Worker 53*8975f5c5SAndroid Build Coastguard Worker- Building should work at this point! Follow the steps on the Wiki. 54*8975f5c5SAndroid Build Coastguard Worker 55*8975f5c5SAndroid Build Coastguard Worker- Try running `angle_end2end_tests`, `angle_unittests` or a sample program. 56*8975f5c5SAndroid Build Coastguard Worker 57*8975f5c5SAndroid Build Coastguard Worker## Setting up the [drawElements testing suite](http://go/dEQP) 58*8975f5c5SAndroid Build Coastguard Worker 59*8975f5c5SAndroid Build Coastguard Worker- [Cherry](https://sites.google.com/a/google.com/deqp/cherry) is the UI for viewing test results. 60*8975f5c5SAndroid Build Coastguard Worker ANGLE checks out a copy in `<angledir>/third_party/cherry`. 61*8975f5c5SAndroid Build Coastguard Worker 62*8975f5c5SAndroid Build Coastguard Worker- Follow the instructions in the 63*8975f5c5SAndroid Build Coastguard Worker [installation README](https://android.googlesource.com/platform/external/cherry/+/refs/heads/main/README) 64*8975f5c5SAndroid Build Coastguard Worker to get it running. On Windows, use 64-bit. 65*8975f5c5SAndroid Build Coastguard Worker 66*8975f5c5SAndroid Build Coastguard Worker- Read up on testing with 67*8975f5c5SAndroid Build Coastguard Worker [dEQP on the ANGLE Wiki](https://chromium.googlesource.com/angle/angle/+/main/doc/dEQP.md). 68*8975f5c5SAndroid Build Coastguard Worker 69*8975f5c5SAndroid Build Coastguard Worker- Try running `angle_deqp_gles2_tests` with the flag 70*8975f5c5SAndroid Build Coastguard Worker `--gtest_filter=dEQP-GLES2.functional.negative_api.*` and load a test report in Cherry. 71*8975f5c5SAndroid Build Coastguard Worker 72*8975f5c5SAndroid Build Coastguard Worker- To use Cherry, browse to [http://localhost:8080/#/results](http://localhost:8080/#/results) and 73*8975f5c5SAndroid Build Coastguard Worker click '**Import existing batch**', loading `TestResults.qpa`. Look for the qpa file in the 74*8975f5c5SAndroid Build Coastguard Worker current working directory, or `<angledir>/src/tests` if you ran the tests from Visual Studio. 75*8975f5c5SAndroid Build Coastguard Worker 76*8975f5c5SAndroid Build Coastguard Worker- Note: we only use Cherry for viewing test output, not running the tests. On start, you may see 77*8975f5c5SAndroid Build Coastguard Worker some runtime messages about unable to load case lists. These are safe to ignore. If you didn't 78*8975f5c5SAndroid Build Coastguard Worker load the results URL directly, click the "**Results**" tab to find the Import button. 79*8975f5c5SAndroid Build Coastguard Worker 80*8975f5c5SAndroid Build Coastguard Worker## Profiling 81*8975f5c5SAndroid Build Coastguard Worker 82*8975f5c5SAndroid Build Coastguard Worker### With Visual Studio 83*8975f5c5SAndroid Build Coastguard Worker 84*8975f5c5SAndroid Build Coastguard Worker- In Visual Studio 2017, look under Debug/Profiler/Performance Explorer/New Performance Session. 85*8975f5c5SAndroid Build Coastguard Worker Right-click "Targets" and add `angle_perftests` as a Target Project. 86*8975f5c5SAndroid Build Coastguard Worker 87*8975f5c5SAndroid Build Coastguard Worker- Run `angle_perftests` with the flag `--gtest_filter=DrawCallPerfBenchmark.Run/d3d11_null` for 88*8975f5c5SAndroid Build Coastguard Worker D3D11, `.../d3d9_null` for D3D9, `.../gl_null` for OpenGL and `.../vulkan_null` for Vulkan. 89*8975f5c5SAndroid Build Coastguard Worker 90*8975f5c5SAndroid Build Coastguard Worker- Make sure you close all open instances of Chrome, they use a lot of background CPU and GPU. In 91*8975f5c5SAndroid Build Coastguard Worker fact, close every process and application you can. 92*8975f5c5SAndroid Build Coastguard Worker 93*8975f5c5SAndroid Build Coastguard Worker### Profiling with Visual Studio + Chrome 94*8975f5c5SAndroid Build Coastguard Worker 95*8975f5c5SAndroid Build Coastguard Worker- Install [Chrome Canary](https://www.google.com/chrome/browser/canary.html). 96*8975f5c5SAndroid Build Coastguard Worker 97*8975f5c5SAndroid Build Coastguard Worker- Canary's install dir is usually `%APPDATA%/Local/Google/Chrome SxS/Application` 98*8975f5c5SAndroid Build Coastguard Worker 99*8975f5c5SAndroid Build Coastguard Worker- Build ANGLE x64, Release, and run 'python scripts/update_chrome_angle.py' to replace Canary's 100*8975f5c5SAndroid Build Coastguard Worker ANGLE with your custom ANGLE. (Note: Canary must be closed) 101*8975f5c5SAndroid Build Coastguard Worker 102*8975f5c5SAndroid Build Coastguard Worker- Start Canary with `--gpu-startup-dialog --disable-gpu-sandbox`, wait for the dialog. 103*8975f5c5SAndroid Build Coastguard Worker 104*8975f5c5SAndroid Build Coastguard Worker- In Visual Studio, under Debug/Profiler, choose attach to process. 105*8975f5c5SAndroid Build Coastguard Worker 106*8975f5c5SAndroid Build Coastguard Worker- Attach to the Chrome GPU process, then immediately pause profiling. 107*8975f5c5SAndroid Build Coastguard Worker 108*8975f5c5SAndroid Build Coastguard Worker- **IMPORTANT:** Verify ANGLE details are correct in `about:gpu`. 109*8975f5c5SAndroid Build Coastguard Worker 110*8975f5c5SAndroid Build Coastguard Worker- In Canary, start your benchmark, then resume profiling, and exit when done. The report will load 111*8975f5c5SAndroid Build Coastguard Worker automatically. 112*8975f5c5SAndroid Build Coastguard Worker 113*8975f5c5SAndroid Build Coastguard Worker## Bookmark the latest Khronos specs 114*8975f5c5SAndroid Build Coastguard Worker 115*8975f5c5SAndroid Build Coastguard Worker- [The GLES 2.0 Spec](https://www.khronos.org/registry/OpenGL/specs/es/2.0/es_full_spec_2.0.pdf) 116*8975f5c5SAndroid Build Coastguard Worker 117*8975f5c5SAndroid Build Coastguard Worker- [The GLES 3.0 Spec](https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf) 118*8975f5c5SAndroid Build Coastguard Worker 119*8975f5c5SAndroid Build Coastguard Worker- [The GLES 3.1 Spec](https://www.khronos.org/registry/gles/specs/3.1/es_spec_3.1.pdf) 120*8975f5c5SAndroid Build Coastguard Worker 121*8975f5c5SAndroid Build Coastguard Worker- [The GLES Shading Language 1.00 Spec](https://www.khronos.org/files/opengles_shading_language.pdf) 122*8975f5c5SAndroid Build Coastguard Worker 123*8975f5c5SAndroid Build Coastguard Worker- [The GLES Shading Language 3.00 Spec](https://www.khronos.org/registry/gles/specs/3.0/GLSL_ES_Specification_3.00.4.pdf) 124*8975f5c5SAndroid Build Coastguard Worker 125*8975f5c5SAndroid Build Coastguard Worker- [The WebGL Specs](https://www.khronos.org/registry/webgl/specs/latest/) 126*8975f5c5SAndroid Build Coastguard Worker 127*8975f5c5SAndroid Build Coastguard Worker- [A modern desktop OpenGL Spec](https://www.opengl.org/registry/doc/glspec45.core.pdf) 128*8975f5c5SAndroid Build Coastguard Worker (for reference) 129*8975f5c5SAndroid Build Coastguard Worker 130*8975f5c5SAndroid Build Coastguard Worker- [The Vulkan Spec](https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/vkspec.html) 131*8975f5c5SAndroid Build Coastguard Worker 132*8975f5c5SAndroid Build Coastguard WorkerThese specs can be found in the [OpenGL Registry](https://github.com/KhronosGroup/OpenGL-Registry) 133*8975f5c5SAndroid Build Coastguard Workerand the [Vulkan Docs](https://github.com/KhronosGroup/Vulkan-Docs) repositories as well. 134*8975f5c5SAndroid Build Coastguard Worker 135*8975f5c5SAndroid Build Coastguard Worker## Join Groups and Chats 136*8975f5c5SAndroid Build Coastguard Worker 137*8975f5c5SAndroid Build Coastguard Worker- Join the `#angle` channel in `chromium.slack.com`. 138*8975f5c5SAndroid Build Coastguard Worker 139*8975f5c5SAndroid Build Coastguard Worker### For Googlers 140*8975f5c5SAndroid Build Coastguard Worker 141*8975f5c5SAndroid Build Coastguard Worker- Join angle-team@ for access to many important emails and shared documents. 142*8975f5c5SAndroid Build Coastguard Worker 143*8975f5c5SAndroid Build Coastguard Worker- We have a Hangouts Chat channel. Ask for an invite. 144