xref: /aosp_15_r20/external/angle/doc/MetalBackendShaders.md (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# Metal Backend Shaders
2
3ANGLE's Metal backend provides a couple of features for inspecting the
4Metal Shading Language (MSL) produced by ANGLE's shader translator.
5
6## printMetalShaders
7
8The [`printMetalShaders`
9feature](https://chromium-review.googlesource.com/c/angle/angle/+/4480976),
10which can be enabled in Chromium via the command line argument
11`--enable-angle-features=printMetalShaders`, dumps the blob cache key
12and translated MSL for all shaders compiled by ANGLE. This is
13currently used to [regenerate precompiled
14shaders](https://crbug.com/1423136) shipped with Chrome.
15
16## Environment variable
17
18Setting the environment variable `ANGLE_METAL_PRINT_MSL_ENABLE` to `1`
19indicates to the Metal backend to print the translated shaders as
20they're compiled:
21
22```
23export ANGLE_METAL_PRINT_MSL_ENABLE=1
24/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --use-angle=metal
25```
26
27To pass this environment to WebKit / Safari's GPU process, set the
28environment variable `__XPC_ANGLE_METAL_PRINT_MSL_ENABLE` to `1`:
29
30```
31export __XPC_ANGLE_METAL_PRINT_MSL_ENABLE=1
32/Applications/Safari\ Technology\ Preview.app/Contents/MacOS/Safari\ Technology\ Preview
33```
34