1*8975f5c5SAndroid Build Coastguard Worker# How to Branch and Roll Chromium's ANGLE Dependency 2*8975f5c5SAndroid Build Coastguard Worker 3*8975f5c5SAndroid Build Coastguard WorkerANGLE provides an implementation of OpenGL ES on top of other APIs (e.g. DirectX11, Vulkan). ANGLE 4*8975f5c5SAndroid Build Coastguard Workeruses (i.e. depends upon) other third-party software that comes from different repositories. ANGLE specifies 5*8975f5c5SAndroid Build Coastguard Workerits dependencies on a specific version of each of these other repositories in the [ANGLE DEPS file](https://chromium.googlesource.com/angle/angle/+/main/DEPS). 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard WorkerChromium relies upon ANGLE for hardware accelerated rendering and WebGL support. Chromium similarly 8*8975f5c5SAndroid Build Coastguard Workerspecifies its dependency on a specific version of ANGLE in the [Chromium repository's src/DEPS file](http://src.chromium.org/viewvc/chrome/trunk/src/DEPS). 9*8975f5c5SAndroid Build Coastguard Worker 10*8975f5c5SAndroid Build Coastguard WorkerThis document describes how to update those dependencies, and, if necessary, create an ANGLE branch 11*8975f5c5SAndroid Build Coastguard Workerto correspond to a branched release of Chrome. 12*8975f5c5SAndroid Build Coastguard Worker 13*8975f5c5SAndroid Build Coastguard WorkerANGLE's commit queue also runs browser-level tests which are hosted in 14*8975f5c5SAndroid Build Coastguard Workerthe Chromium repository. To reduce the chance of a Chromium-side 15*8975f5c5SAndroid Build Coastguard Workerchange breaking ANGLE's CQ, the version of Chromium against which 16*8975f5c5SAndroid Build Coastguard WorkerANGLE changes is also snapshotted, and rolled forward into ANGLE with 17*8975f5c5SAndroid Build Coastguard Workerappropriate testing. 18*8975f5c5SAndroid Build Coastguard Worker 19*8975f5c5SAndroid Build Coastguard Worker## Autorollers 20*8975f5c5SAndroid Build Coastguard Worker 21*8975f5c5SAndroid Build Coastguard WorkerAt present, autorollers manage both the ANGLE roll into Chromium, and 22*8975f5c5SAndroid Build Coastguard Workerthe Chromium roll into ANGLE. There is also an autoroller for ANGLE into [Android AOSP](https://android.googlesource.com/platform/external/angle/). 23*8975f5c5SAndroid Build Coastguard WorkerAll of the ANGLE-related autorollers are documented in the [ANGLE Wrangling documentation](../infra/ANGLEWrangling.md#the-auto-rollers). 24*8975f5c5SAndroid Build Coastguard Worker 25*8975f5c5SAndroid Build Coastguard Worker## Manually rolling DEPS 26*8975f5c5SAndroid Build Coastguard Worker 27*8975f5c5SAndroid Build Coastguard WorkerAs mentioned above, dependencies are encoded in `DEPS` files. The process to update a given 28*8975f5c5SAndroid Build Coastguard Workerdependency is as follows: 29*8975f5c5SAndroid Build Coastguard Worker 30*8975f5c5SAndroid Build Coastguard Worker * Find the appropriate line in the relevant `DEPS` file that defines the dependency 31*8975f5c5SAndroid Build Coastguard Worker * Change the [git SHA-1 revision number](http://git-scm.com/book/ch6-1.html) to be that of the commit 32*8975f5c5SAndroid Build Coastguard Workeron which to depend upon (Note: use the full SHA-1, not a 33*8975f5c5SAndroid Build Coastguard Workershortened version) 34*8975f5c5SAndroid Build Coastguard Worker * You can find the SHA-1 for a particular commit with `git log` on the appropriate branch of the 35*8975f5c5SAndroid Build Coastguard Workerrepository, or via a public repository viewer 36*8975f5c5SAndroid Build Coastguard Worker * If using the [ANGLE public repository viewer](https://chromium.googlesource.com/angle/angle), you will need to select the branch whose log you 37*8975f5c5SAndroid Build Coastguard Workerwish to view from the list on the left-hand side, and then click on the "tree" link at the top of 38*8975f5c5SAndroid Build Coastguard Workerthe resulting page. Alternatively, you can navigate to 39*8975f5c5SAndroid Build Coastguard Worker`https://chromium.googlesource.com/angle/angle/+/<branch name>/` -- 40*8975f5c5SAndroid Build Coastguard Workerincluding the terminating forward slash. (e.g. 41*8975f5c5SAndroid Build Coastguard Worker`https://chromium.googlesource.com/angle/angle/+/main/`) 42*8975f5c5SAndroid Build Coastguard Worker 43*8975f5c5SAndroid Build Coastguard Worker### Rolling Vulkan Memory Allocator (VMA) 44*8975f5c5SAndroid Build Coastguard Worker 45*8975f5c5SAndroid Build Coastguard WorkerANGLE and other Google projects (e.g. Skia, Chrome) use the open-source [Vulkan Memory Allocator][vma-upstream] (VMA) 46*8975f5c5SAndroid Build Coastguard Workerlibrary. As with with other external repositories, these projects do not directly use the [upstream Vulkan Memory Allocator][vma-upstream] repository. 47*8975f5c5SAndroid Build Coastguard WorkerInstead, a [Google-local repository][vma-chrome] is used, which contains Google-local changes and fixes (e.g. changes 48*8975f5c5SAndroid Build Coastguard Workerto `BUILD.gn`). This Google-local repository repository contains the following key branches: 49*8975f5c5SAndroid Build Coastguard Worker 50*8975f5c5SAndroid Build Coastguard Worker- `upstream/master` is automatically mirrored with the contents of the [upstream VMA][vma-upstream] repository 51*8975f5c5SAndroid Build Coastguard Worker- `main` is manually curated by Google, with a combination of upstream and Google-local changes 52*8975f5c5SAndroid Build Coastguard Worker 53*8975f5c5SAndroid Build Coastguard WorkerANGLE's `DEPS` file points to a git SHA-1 revision of the `main` branch. 54*8975f5c5SAndroid Build Coastguard Worker 55*8975f5c5SAndroid Build Coastguard WorkerManual rolls of the `main` branch currently involve rebasing all of the Google-local changes on top of newer upstream changes. The current process (done in 2022) is to: 56*8975f5c5SAndroid Build Coastguard Worker 57*8975f5c5SAndroid Build Coastguard Worker * Revert all of the Google-local changes (i.e. with a single commit) 58*8975f5c5SAndroid Build Coastguard Worker * Merge or cherry-pick all of the upstream changes 59*8975f5c5SAndroid Build Coastguard Worker * Cherry-pick the Google-local changes on top 60*8975f5c5SAndroid Build Coastguard Worker * Note: it may be possible to simply merge future upstream changes directly, without reverting the Google-local changes 61*8975f5c5SAndroid Build Coastguard Worker 62*8975f5c5SAndroid Build Coastguard WorkerManual rolls of which SHA-1 revision the ANGLE's `DEPS` file points to is done via the process 63*8975f5c5SAndroid Build Coastguard Workeroutlined above. Within an ANGLE build, you can navigate to the `third_party/vulkan_memory_allocator` 64*8975f5c5SAndroid Build Coastguard Workerdirectory, check out the `main` branch, and use `git log` to select the desired Git revision. 65*8975f5c5SAndroid Build Coastguard Worker**Please note** that cross-project coordination may be required when rolling VMA, as some projects (e.g. Chrome) builds itself with a single VMA version across Chrome, ANGLE, and Skia. 66*8975f5c5SAndroid Build Coastguard Worker 67*8975f5c5SAndroid Build Coastguard Worker[vma-upstream]: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator 68*8975f5c5SAndroid Build Coastguard Worker[vma-chrome]: https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator 69*8975f5c5SAndroid Build Coastguard Worker 70*8975f5c5SAndroid Build Coastguard WorkerNote: When ANGLE is AutoRolled to the Android AOSP source tree, Google-local 71*8975f5c5SAndroid Build Coastguard Workerchanges to the VMA `BUILD.gn` file will be converted to the ANGLE `Android.bp` file. 72*8975f5c5SAndroid Build Coastguard Worker 73*8975f5c5SAndroid Build Coastguard Worker## Branching ANGLE 74*8975f5c5SAndroid Build Coastguard Worker 75*8975f5c5SAndroid Build Coastguard WorkerSometimes, individual changes to ANGLE are needed for a release of Chrome which 76*8975f5c5SAndroid Build Coastguard Workerhas already been branched. If this is the case, a branch of ANGLE should be 77*8975f5c5SAndroid Build Coastguard Workercreated to correspond to the Chrome release version, so that Chrome may 78*8975f5c5SAndroid Build Coastguard Workerincorporate only these changes, and not everything that has been committed since 79*8975f5c5SAndroid Build Coastguard Workerthe version on which Chrome depended at branch time. **Please note: Only ANGLE 80*8975f5c5SAndroid Build Coastguard Workeradmins can create a new branch.** To create a branch of ANGLE for a branched 81*8975f5c5SAndroid Build Coastguard WorkerChrome release: 82*8975f5c5SAndroid Build Coastguard Worker 83*8975f5c5SAndroid Build Coastguard Worker * Determine what the ANGLE dependency is for the Chrome release 84*8975f5c5SAndroid Build Coastguard Workerby checking the DEPS file for that branch. 85*8975f5c5SAndroid Build Coastguard Worker * Check out this commit as a new branch in your local repository. 86*8975f5c5SAndroid Build Coastguard Worker * e.g., for [the Chrome 34 release at 87*8975f5c5SAndroid Build Coastguard Workerchrome/branches/1847](http://src.chromium.org/viewvc/chrome/branches/1847/src/DEPS), 88*8975f5c5SAndroid Build Coastguard Workerthe ANGLE version is 4df02c1ed5e97dd54576b06964b1da67ea30238e. To 89*8975f5c5SAndroid Build Coastguard Workercheck this commit out locally and create a new branch named 'mybranch' 90*8975f5c5SAndroid Build Coastguard Workerfrom this commit, use: ```git checkout -b mybranch 91*8975f5c5SAndroid Build Coastguard Worker4df02c1ed5e97dd54576b06964b1da67ea30238e``` 92*8975f5c5SAndroid Build Coastguard Worker * To create this new branch in the public repository, you'll need to push the 93*8975f5c5SAndroid Build Coastguard Workerbranch to the special Gerrit reference location, 'refs/heads/<branch name>'. You 94*8975f5c5SAndroid Build Coastguard Workermust be an ANGLE administrator to be able to push this new branch. 95*8975f5c5SAndroid Build Coastguard Worker * e.g., to use your local 'mybranch' to create a branch in the public repository called 96*8975f5c5SAndroid Build Coastguard Worker'chrome\_m34', use: ```git push origin mybranch:refs/heads/chrome_m34``` 97*8975f5c5SAndroid Build Coastguard Worker * The naming convention that ANGLE uses for its release-dedicated branches is 'chrome\_m##'. 98