xref: /aosp_15_r20/external/angle/third_party/glslang/src/README.md (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker![Continuous Integration](https://github.com/KhronosGroup/glslang/actions/workflows/continuous_integration.yml/badge.svg)
2*8975f5c5SAndroid Build Coastguard Worker![Continuous Deployment](https://github.com/KhronosGroup/glslang/actions/workflows/continuous_deployment.yml/badge.svg)
3*8975f5c5SAndroid Build Coastguard Worker[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/KhronosGroup/glslang/badge)](https://securityscorecards.dev/viewer/?uri=github.com/KhronosGroup/glslang)
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Worker# News
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Worker1. Building glslang as a DLL or shared library is now possible and supported.
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard Worker2. The `GenericCodeGen`, `MachineIndependent`, `OSDependent`, and `SPIRV` libraries have been integrated into the main `glslang` library. The old separate libraries have replaced with empty stubs for a temporary compatibility period, and they will be removed entirely in the future.
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard Worker3. A new CMake `ENABLE_SPIRV` option has been added to control whether glslang is built with SPIR-V support. Its default value is `ON`.
12*8975f5c5SAndroid Build Coastguard Worker
13*8975f5c5SAndroid Build Coastguard Worker4. `OGLCompiler` and `HLSL` stub libraries have been fully removed from the build.
14*8975f5c5SAndroid Build Coastguard Worker
15*8975f5c5SAndroid Build Coastguard Worker# Glslang Components and Status
16*8975f5c5SAndroid Build Coastguard Worker
17*8975f5c5SAndroid Build Coastguard WorkerThere are several components:
18*8975f5c5SAndroid Build Coastguard Worker
19*8975f5c5SAndroid Build Coastguard Worker### Reference Validator and GLSL/ESSL -> AST Front End
20*8975f5c5SAndroid Build Coastguard Worker
21*8975f5c5SAndroid Build Coastguard WorkerAn OpenGL GLSL and OpenGL|ES GLSL (ESSL) front-end for reference validation and translation of GLSL/ESSL into an internal abstract syntax tree (AST).
22*8975f5c5SAndroid Build Coastguard Worker
23*8975f5c5SAndroid Build Coastguard Worker**Status**: Virtually complete, with results carrying similar weight as the specifications.
24*8975f5c5SAndroid Build Coastguard Worker
25*8975f5c5SAndroid Build Coastguard Worker### HLSL -> AST Front End
26*8975f5c5SAndroid Build Coastguard Worker
27*8975f5c5SAndroid Build Coastguard WorkerAn HLSL front-end for translation of an approximation of HLSL to glslang's AST form.
28*8975f5c5SAndroid Build Coastguard Worker
29*8975f5c5SAndroid Build Coastguard Worker**Status**: Partially complete. Semantics are not reference quality and input is not validated.
30*8975f5c5SAndroid Build Coastguard WorkerThis is in contrast to the [DXC project](https://github.com/Microsoft/DirectXShaderCompiler), which receives a much larger investment and attempts to have definitive/reference-level semantics.
31*8975f5c5SAndroid Build Coastguard Worker
32*8975f5c5SAndroid Build Coastguard WorkerSee [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status.
33*8975f5c5SAndroid Build Coastguard Worker
34*8975f5c5SAndroid Build Coastguard Worker### AST -> SPIR-V Back End
35*8975f5c5SAndroid Build Coastguard Worker
36*8975f5c5SAndroid Build Coastguard WorkerTranslates glslang's AST to the Khronos-specified SPIR-V intermediate language.
37*8975f5c5SAndroid Build Coastguard Worker
38*8975f5c5SAndroid Build Coastguard Worker**Status**: Virtually complete.
39*8975f5c5SAndroid Build Coastguard Worker
40*8975f5c5SAndroid Build Coastguard Worker### Reflector
41*8975f5c5SAndroid Build Coastguard Worker
42*8975f5c5SAndroid Build Coastguard WorkerAn API for getting reflection information from the AST, reflection types/variables/etc. from the HLL source (not the SPIR-V).
43*8975f5c5SAndroid Build Coastguard Worker
44*8975f5c5SAndroid Build Coastguard Worker**Status**: There is a large amount of functionality present, but no specification/goal to measure completeness against.  It is accurate for the input HLL and AST, but only approximate for what would later be emitted for SPIR-V.
45*8975f5c5SAndroid Build Coastguard Worker
46*8975f5c5SAndroid Build Coastguard Worker### Standalone Wrapper
47*8975f5c5SAndroid Build Coastguard Worker
48*8975f5c5SAndroid Build Coastguard Worker`glslang` is command-line tool for accessing the functionality above.
49*8975f5c5SAndroid Build Coastguard Worker
50*8975f5c5SAndroid Build Coastguard WorkerStatus: Complete.
51*8975f5c5SAndroid Build Coastguard Worker
52*8975f5c5SAndroid Build Coastguard WorkerTasks waiting to be done are documented as GitHub issues.
53*8975f5c5SAndroid Build Coastguard Worker
54*8975f5c5SAndroid Build Coastguard Worker## Other References
55*8975f5c5SAndroid Build Coastguard Worker
56*8975f5c5SAndroid Build Coastguard WorkerAlso see the Khronos landing page for glslang as a reference front end:
57*8975f5c5SAndroid Build Coastguard Worker
58*8975f5c5SAndroid Build Coastguard Workerhttps://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
59*8975f5c5SAndroid Build Coastguard Worker
60*8975f5c5SAndroid Build Coastguard WorkerThe above page, while not kept up to date, includes additional information regarding glslang as a reference validator.
61*8975f5c5SAndroid Build Coastguard Worker
62*8975f5c5SAndroid Build Coastguard Worker# How to Use Glslang
63*8975f5c5SAndroid Build Coastguard Worker
64*8975f5c5SAndroid Build Coastguard Worker## Execution of Standalone Wrapper
65*8975f5c5SAndroid Build Coastguard Worker
66*8975f5c5SAndroid Build Coastguard WorkerTo use the standalone binary form, execute `glslang`, and it will print
67*8975f5c5SAndroid Build Coastguard Workera usage statement.  Basic operation is to give it a file containing a shader,
68*8975f5c5SAndroid Build Coastguard Workerand it will print out warnings/errors and optionally an AST.
69*8975f5c5SAndroid Build Coastguard Worker
70*8975f5c5SAndroid Build Coastguard WorkerThe applied stage-specific rules are based on the file extension:
71*8975f5c5SAndroid Build Coastguard Worker* `.vert` for a vertex shader
72*8975f5c5SAndroid Build Coastguard Worker* `.tesc` for a tessellation control shader
73*8975f5c5SAndroid Build Coastguard Worker* `.tese` for a tessellation evaluation shader
74*8975f5c5SAndroid Build Coastguard Worker* `.geom` for a geometry shader
75*8975f5c5SAndroid Build Coastguard Worker* `.frag` for a fragment shader
76*8975f5c5SAndroid Build Coastguard Worker* `.comp` for a compute shader
77*8975f5c5SAndroid Build Coastguard Worker
78*8975f5c5SAndroid Build Coastguard WorkerFor ray tracing pipeline shaders:
79*8975f5c5SAndroid Build Coastguard Worker* `.rgen` for a ray generation shader
80*8975f5c5SAndroid Build Coastguard Worker* `.rint` for a ray intersection shader
81*8975f5c5SAndroid Build Coastguard Worker* `.rahit` for a ray any-hit shader
82*8975f5c5SAndroid Build Coastguard Worker* `.rchit` for a ray closest-hit shader
83*8975f5c5SAndroid Build Coastguard Worker* `.rmiss` for a ray miss shader
84*8975f5c5SAndroid Build Coastguard Worker* `.rcall` for a callable shader
85*8975f5c5SAndroid Build Coastguard Worker
86*8975f5c5SAndroid Build Coastguard WorkerThere is also a non-shader extension:
87*8975f5c5SAndroid Build Coastguard Worker* `.conf` for a configuration file of limits, see usage statement for example
88*8975f5c5SAndroid Build Coastguard Worker
89*8975f5c5SAndroid Build Coastguard Worker## Building (CMake)
90*8975f5c5SAndroid Build Coastguard Worker
91*8975f5c5SAndroid Build Coastguard WorkerInstead of building manually, you can also download the binaries for your
92*8975f5c5SAndroid Build Coastguard Workerplatform directly from the [main-tot release][main-tot-release] on GitHub.
93*8975f5c5SAndroid Build Coastguard WorkerThose binaries are automatically uploaded by the buildbots after successful
94*8975f5c5SAndroid Build Coastguard Workertesting and they always reflect the current top of the tree of the main
95*8975f5c5SAndroid Build Coastguard Workerbranch.
96*8975f5c5SAndroid Build Coastguard Worker
97*8975f5c5SAndroid Build Coastguard Worker### Dependencies
98*8975f5c5SAndroid Build Coastguard Worker
99*8975f5c5SAndroid Build Coastguard Worker* A C++17 compiler.
100*8975f5c5SAndroid Build Coastguard Worker  (For MSVS: use 2019 or later.)
101*8975f5c5SAndroid Build Coastguard Worker* [CMake][cmake]: for generating compilation targets.
102*8975f5c5SAndroid Build Coastguard Worker* make: _Linux_, ninja is an alternative, if configured.
103*8975f5c5SAndroid Build Coastguard Worker* [Python 3.x][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools and the 'External' subdirectory does not exist.)
104*8975f5c5SAndroid Build Coastguard Worker* [bison][bison]: _optional_, but needed when changing the grammar (glslang.y).
105*8975f5c5SAndroid Build Coastguard Worker* [googletest][googletest]: _optional_, but should use if making any changes to glslang.
106*8975f5c5SAndroid Build Coastguard Worker
107*8975f5c5SAndroid Build Coastguard Worker### Build steps
108*8975f5c5SAndroid Build Coastguard Worker
109*8975f5c5SAndroid Build Coastguard WorkerThe following steps assume a Bash shell. On Windows, that could be the Git Bash
110*8975f5c5SAndroid Build Coastguard Workershell or some other shell of your choosing.
111*8975f5c5SAndroid Build Coastguard Worker
112*8975f5c5SAndroid Build Coastguard Worker#### 1) Check-Out this project
113*8975f5c5SAndroid Build Coastguard Worker
114*8975f5c5SAndroid Build Coastguard Worker```bash
115*8975f5c5SAndroid Build Coastguard Workercd <parent of where you want glslang to be>
116*8975f5c5SAndroid Build Coastguard Workergit clone https://github.com/KhronosGroup/glslang.git
117*8975f5c5SAndroid Build Coastguard Worker```
118*8975f5c5SAndroid Build Coastguard Worker
119*8975f5c5SAndroid Build Coastguard Worker#### 2) Check-Out External Projects
120*8975f5c5SAndroid Build Coastguard Worker
121*8975f5c5SAndroid Build Coastguard Worker```bash
122*8975f5c5SAndroid Build Coastguard Worker./update_glslang_sources.py
123*8975f5c5SAndroid Build Coastguard Worker```
124*8975f5c5SAndroid Build Coastguard Worker
125*8975f5c5SAndroid Build Coastguard Worker#### 3) Configure
126*8975f5c5SAndroid Build Coastguard Worker
127*8975f5c5SAndroid Build Coastguard WorkerAssume the source directory is `$SOURCE_DIR` and the build directory is `$BUILD_DIR`.
128*8975f5c5SAndroid Build Coastguard WorkerCMake will create the `$BUILD_DIR` for the user if it doesn't exist.
129*8975f5c5SAndroid Build Coastguard Worker
130*8975f5c5SAndroid Build Coastguard WorkerFirst change your working directory:
131*8975f5c5SAndroid Build Coastguard Worker```bash
132*8975f5c5SAndroid Build Coastguard Workercd $SOURCE_DIR
133*8975f5c5SAndroid Build Coastguard Worker```
134*8975f5c5SAndroid Build Coastguard Worker
135*8975f5c5SAndroid Build Coastguard WorkerFor building on Linux:
136*8975f5c5SAndroid Build Coastguard Worker
137*8975f5c5SAndroid Build Coastguard Worker```bash
138*8975f5c5SAndroid Build Coastguard Workercmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
139*8975f5c5SAndroid Build Coastguard Worker# "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo"
140*8975f5c5SAndroid Build Coastguard Worker```
141*8975f5c5SAndroid Build Coastguard Worker
142*8975f5c5SAndroid Build Coastguard WorkerFor building on Android:
143*8975f5c5SAndroid Build Coastguard Worker```bash
144*8975f5c5SAndroid Build Coastguard Workercmake -B $BUILD_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
145*8975f5c5SAndroid Build Coastguard Worker# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_HOME%\prebuilt\windows-x86_64\bin\make.exe
146*8975f5c5SAndroid Build Coastguard Worker# -G is needed for building on Windows
147*8975f5c5SAndroid Build Coastguard Worker# -DANDROID_ABI can also be armeabi-v7a for 32 bit
148*8975f5c5SAndroid Build Coastguard Worker```
149*8975f5c5SAndroid Build Coastguard Worker
150*8975f5c5SAndroid Build Coastguard WorkerFor building on Windows:
151*8975f5c5SAndroid Build Coastguard Worker
152*8975f5c5SAndroid Build Coastguard Worker```bash
153*8975f5c5SAndroid Build Coastguard Workercmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
154*8975f5c5SAndroid Build Coastguard Worker# The CMAKE_INSTALL_PREFIX part is for testing (explained later).
155*8975f5c5SAndroid Build Coastguard Worker```
156*8975f5c5SAndroid Build Coastguard Worker
157*8975f5c5SAndroid Build Coastguard WorkerAlso, consider using `git config --global core.fileMode false` (or with `--local`) on Windows
158*8975f5c5SAndroid Build Coastguard Workerto prevent the addition of execution permission on files.
159*8975f5c5SAndroid Build Coastguard Worker
160*8975f5c5SAndroid Build Coastguard Worker#### 4) Build and Install
161*8975f5c5SAndroid Build Coastguard Worker
162*8975f5c5SAndroid Build Coastguard Worker```bash
163*8975f5c5SAndroid Build Coastguard Worker# for Linux:
164*8975f5c5SAndroid Build Coastguard Workermake -j4 install
165*8975f5c5SAndroid Build Coastguard Worker
166*8975f5c5SAndroid Build Coastguard Worker# for Windows:
167*8975f5c5SAndroid Build Coastguard Workercmake --build . --config Release --target install
168*8975f5c5SAndroid Build Coastguard Worker# "Release" (for --config) could also be "Debug", "MinSizeRel", or "RelWithDebInfo"
169*8975f5c5SAndroid Build Coastguard Worker```
170*8975f5c5SAndroid Build Coastguard Worker
171*8975f5c5SAndroid Build Coastguard WorkerIf using MSVC, after running CMake to configure, use the
172*8975f5c5SAndroid Build Coastguard WorkerConfiguration Manager to check the `INSTALL` project.
173*8975f5c5SAndroid Build Coastguard Worker
174*8975f5c5SAndroid Build Coastguard Worker### Building (GN)
175*8975f5c5SAndroid Build Coastguard Worker
176*8975f5c5SAndroid Build Coastguard Workerglslang can also be built with the [GN build system](https://gn.googlesource.com/gn/).
177*8975f5c5SAndroid Build Coastguard Worker
178*8975f5c5SAndroid Build Coastguard Worker#### 1) Install `depot_tools`
179*8975f5c5SAndroid Build Coastguard Worker
180*8975f5c5SAndroid Build Coastguard WorkerDownload [depot_tools.zip](https://storage.googleapis.com/chrome-infra/depot_tools.zip),
181*8975f5c5SAndroid Build Coastguard Workerextract to a directory, and add this directory to your `PATH`.
182*8975f5c5SAndroid Build Coastguard Worker
183*8975f5c5SAndroid Build Coastguard Worker#### 2) Synchronize dependencies and generate build files
184*8975f5c5SAndroid Build Coastguard Worker
185*8975f5c5SAndroid Build Coastguard WorkerThis only needs to be done once after updating `glslang`.
186*8975f5c5SAndroid Build Coastguard Worker
187*8975f5c5SAndroid Build Coastguard WorkerWith the current directory set to your `glslang` checkout, type:
188*8975f5c5SAndroid Build Coastguard Worker
189*8975f5c5SAndroid Build Coastguard Worker```bash
190*8975f5c5SAndroid Build Coastguard Worker./update_glslang_sources.py
191*8975f5c5SAndroid Build Coastguard Workergclient sync --gclientfile=standalone.gclient
192*8975f5c5SAndroid Build Coastguard Workergn gen out/Default
193*8975f5c5SAndroid Build Coastguard Worker```
194*8975f5c5SAndroid Build Coastguard Worker
195*8975f5c5SAndroid Build Coastguard Worker#### 3) Build
196*8975f5c5SAndroid Build Coastguard Worker
197*8975f5c5SAndroid Build Coastguard WorkerWith the current directory set to your `glslang` checkout, type:
198*8975f5c5SAndroid Build Coastguard Worker
199*8975f5c5SAndroid Build Coastguard Worker```bash
200*8975f5c5SAndroid Build Coastguard Workercd out/Default
201*8975f5c5SAndroid Build Coastguard Workerninja
202*8975f5c5SAndroid Build Coastguard Worker```
203*8975f5c5SAndroid Build Coastguard Worker
204*8975f5c5SAndroid Build Coastguard Worker### If you need to change the GLSL grammar
205*8975f5c5SAndroid Build Coastguard Worker
206*8975f5c5SAndroid Build Coastguard WorkerThe grammar in `glslang/MachineIndependent/glslang.y` has to be recompiled with
207*8975f5c5SAndroid Build Coastguard Workerbison if it changes, the output files are committed to the repo to avoid every
208*8975f5c5SAndroid Build Coastguard Workerdeveloper needing to have bison configured to compile the project when grammar
209*8975f5c5SAndroid Build Coastguard Workerchanges are quite infrequent. For windows you can get binaries from
210*8975f5c5SAndroid Build Coastguard Worker[GnuWin32][bison-gnu-win32].
211*8975f5c5SAndroid Build Coastguard Worker
212*8975f5c5SAndroid Build Coastguard WorkerThe command to rebuild is:
213*8975f5c5SAndroid Build Coastguard Worker
214*8975f5c5SAndroid Build Coastguard Worker```bash
215*8975f5c5SAndroid Build Coastguard Workerbison --defines=MachineIndependent/glslang_tab.cpp.h
216*8975f5c5SAndroid Build Coastguard Worker      -t MachineIndependent/glslang.y
217*8975f5c5SAndroid Build Coastguard Worker      -o MachineIndependent/glslang_tab.cpp
218*8975f5c5SAndroid Build Coastguard Worker```
219*8975f5c5SAndroid Build Coastguard Worker
220*8975f5c5SAndroid Build Coastguard WorkerThe above command is also available in the bash script in `updateGrammar`,
221*8975f5c5SAndroid Build Coastguard Workerwhen executed from the glslang subdirectory of the glslang repository.
222*8975f5c5SAndroid Build Coastguard Worker
223*8975f5c5SAndroid Build Coastguard Worker### Building to WASM for the Web and Node
224*8975f5c5SAndroid Build Coastguard Worker### Building a standalone JS/WASM library for the Web and Node
225*8975f5c5SAndroid Build Coastguard Worker
226*8975f5c5SAndroid Build Coastguard WorkerUse the steps in [Build Steps](#build-steps), with the following notes/exceptions:
227*8975f5c5SAndroid Build Coastguard Worker* `emsdk` needs to be present in your executable search path, *PATH* for
228*8975f5c5SAndroid Build Coastguard Worker  Bash-like environments:
229*8975f5c5SAndroid Build Coastguard Worker  + [Instructions located here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
230*8975f5c5SAndroid Build Coastguard Worker* Wrap cmake call: `emcmake cmake`
231*8975f5c5SAndroid Build Coastguard Worker* Set `-DENABLE_OPT=OFF`.
232*8975f5c5SAndroid Build Coastguard Worker* Set `-DENABLE_HLSL=OFF` if HLSL is not needed.
233*8975f5c5SAndroid Build Coastguard Worker* For a standalone JS/WASM library, turn on `-DENABLE_GLSLANG_JS=ON`.
234*8975f5c5SAndroid Build Coastguard Worker* To get a fully minimized build, make sure to use `brotli` to compress the .js
235*8975f5c5SAndroid Build Coastguard Worker  and .wasm files
236*8975f5c5SAndroid Build Coastguard Worker* Note that by default, Emscripten allocates a very small stack size, which may
237*8975f5c5SAndroid Build Coastguard Worker  cause stack overflows when compiling large shaders. Use the
238*8975f5c5SAndroid Build Coastguard Worker  [STACK_SIZE](https://emscripten.org/docs/tools_reference/settings_reference.html?highlight=environment#stack-size)
239*8975f5c5SAndroid Build Coastguard Worker  compiler setting to increase the stack size.
240*8975f5c5SAndroid Build Coastguard Worker
241*8975f5c5SAndroid Build Coastguard WorkerExample:
242*8975f5c5SAndroid Build Coastguard Worker
243*8975f5c5SAndroid Build Coastguard Worker```sh
244*8975f5c5SAndroid Build Coastguard Workeremcmake cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_JS=ON \
245*8975f5c5SAndroid Build Coastguard Worker    -DENABLE_HLSL=OFF -DENABLE_OPT=OFF ..
246*8975f5c5SAndroid Build Coastguard Worker```
247*8975f5c5SAndroid Build Coastguard Worker
248*8975f5c5SAndroid Build Coastguard Worker## Building glslang - Using vcpkg
249*8975f5c5SAndroid Build Coastguard Worker
250*8975f5c5SAndroid Build Coastguard WorkerYou can download and install glslang using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
251*8975f5c5SAndroid Build Coastguard Worker
252*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/Microsoft/vcpkg.git
253*8975f5c5SAndroid Build Coastguard Worker    cd vcpkg
254*8975f5c5SAndroid Build Coastguard Worker    ./bootstrap-vcpkg.sh
255*8975f5c5SAndroid Build Coastguard Worker    ./vcpkg integrate install
256*8975f5c5SAndroid Build Coastguard Worker    ./vcpkg install glslang
257*8975f5c5SAndroid Build Coastguard Worker
258*8975f5c5SAndroid Build Coastguard WorkerThe glslang port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
259*8975f5c5SAndroid Build Coastguard Worker
260*8975f5c5SAndroid Build Coastguard Worker## Testing
261*8975f5c5SAndroid Build Coastguard Worker
262*8975f5c5SAndroid Build Coastguard WorkerRight now, there are two test harnesses existing in glslang: one is [Google
263*8975f5c5SAndroid Build Coastguard WorkerTest](gtests/), one is the [`runtests` script](Test/runtests). The former
264*8975f5c5SAndroid Build Coastguard Workerruns unit tests and single-shader single-threaded integration tests, while
265*8975f5c5SAndroid Build Coastguard Workerthe latter runs multiple-shader linking tests and multi-threaded tests.
266*8975f5c5SAndroid Build Coastguard Worker
267*8975f5c5SAndroid Build Coastguard WorkerTests may erroneously fail or pass if using `ALLOW_EXTERNAL_SPIRV_TOOLS` with
268*8975f5c5SAndroid Build Coastguard Workerany commit other than the one specified in `known_good.json`.
269*8975f5c5SAndroid Build Coastguard Worker
270*8975f5c5SAndroid Build Coastguard Worker### Running tests
271*8975f5c5SAndroid Build Coastguard Worker
272*8975f5c5SAndroid Build Coastguard WorkerThe [`runtests` script](Test/runtests) requires compiled binaries to be
273*8975f5c5SAndroid Build Coastguard Workerinstalled into `$BUILD_DIR/install`. Please make sure you have supplied the
274*8975f5c5SAndroid Build Coastguard Workercorrect configuration to CMake (using `-DCMAKE_INSTALL_PREFIX`) when building;
275*8975f5c5SAndroid Build Coastguard Workerotherwise, you may want to modify the path in the `runtests` script.
276*8975f5c5SAndroid Build Coastguard Worker
277*8975f5c5SAndroid Build Coastguard WorkerRunning Google Test-backed tests:
278*8975f5c5SAndroid Build Coastguard Worker
279*8975f5c5SAndroid Build Coastguard Worker```bash
280*8975f5c5SAndroid Build Coastguard Workercd $BUILD_DIR
281*8975f5c5SAndroid Build Coastguard Worker
282*8975f5c5SAndroid Build Coastguard Worker# for Linux:
283*8975f5c5SAndroid Build Coastguard Workerctest
284*8975f5c5SAndroid Build Coastguard Worker
285*8975f5c5SAndroid Build Coastguard Worker# for Windows:
286*8975f5c5SAndroid Build Coastguard Workerctest -C {Debug|Release|RelWithDebInfo|MinSizeRel}
287*8975f5c5SAndroid Build Coastguard Worker
288*8975f5c5SAndroid Build Coastguard Worker# or, run the test binary directly
289*8975f5c5SAndroid Build Coastguard Worker# (which gives more fine-grained control like filtering):
290*8975f5c5SAndroid Build Coastguard Worker<dir-to-glslangtests-in-build-dir>/glslangtests
291*8975f5c5SAndroid Build Coastguard Worker```
292*8975f5c5SAndroid Build Coastguard Worker
293*8975f5c5SAndroid Build Coastguard WorkerRunning `runtests` script-backed tests:
294*8975f5c5SAndroid Build Coastguard Worker
295*8975f5c5SAndroid Build Coastguard Worker```bash
296*8975f5c5SAndroid Build Coastguard Workercd $SOURCE_DIR/Test && ./runtests
297*8975f5c5SAndroid Build Coastguard Worker```
298*8975f5c5SAndroid Build Coastguard Worker
299*8975f5c5SAndroid Build Coastguard WorkerIf some tests fail with validation errors, there may be a mismatch between the
300*8975f5c5SAndroid Build Coastguard Workerversion of `spirv-val` on the system and the version of glslang.  In this
301*8975f5c5SAndroid Build Coastguard Workercase, it is necessary to run `update_glslang_sources.py`.  See "Check-Out
302*8975f5c5SAndroid Build Coastguard WorkerExternal Projects" above for more details.
303*8975f5c5SAndroid Build Coastguard Worker
304*8975f5c5SAndroid Build Coastguard Worker### Contributing tests
305*8975f5c5SAndroid Build Coastguard Worker
306*8975f5c5SAndroid Build Coastguard WorkerTest results should always be included with a pull request that modifies
307*8975f5c5SAndroid Build Coastguard Workerfunctionality.
308*8975f5c5SAndroid Build Coastguard Worker
309*8975f5c5SAndroid Build Coastguard WorkerIf you are writing unit tests, please use the Google Test framework and
310*8975f5c5SAndroid Build Coastguard Workerplace the tests under the `gtests/` directory.
311*8975f5c5SAndroid Build Coastguard Worker
312*8975f5c5SAndroid Build Coastguard WorkerIntegration tests are placed in the `Test/` directory. It contains test input
313*8975f5c5SAndroid Build Coastguard Workerand a subdirectory `baseResults/` that contains the expected results of the
314*8975f5c5SAndroid Build Coastguard Workertests.  Both the tests and `baseResults/` are under source-code control.
315*8975f5c5SAndroid Build Coastguard Worker
316*8975f5c5SAndroid Build Coastguard WorkerGoogle Test runs those integration tests by reading the test input, compiling
317*8975f5c5SAndroid Build Coastguard Workerthem, and then compare against the expected results in `baseResults/`. The
318*8975f5c5SAndroid Build Coastguard Workerintegration tests to run via Google Test is registered in various
319*8975f5c5SAndroid Build Coastguard Worker`gtests/*.FromFile.cpp` source files. `glslangtests` provides a command-line
320*8975f5c5SAndroid Build Coastguard Workeroption `--update-mode`, which, if supplied, will overwrite the golden files
321*8975f5c5SAndroid Build Coastguard Workerunder the `baseResults/` directory with real output from that invocation.
322*8975f5c5SAndroid Build Coastguard WorkerFor more information, please check `gtests/` directory's
323*8975f5c5SAndroid Build Coastguard Worker[README](gtests/README.md).
324*8975f5c5SAndroid Build Coastguard Worker
325*8975f5c5SAndroid Build Coastguard WorkerFor the `runtests` script, it will generate current results in the
326*8975f5c5SAndroid Build Coastguard Worker`localResults/` directory and `diff` them against the `baseResults/`.
327*8975f5c5SAndroid Build Coastguard WorkerWhen you want to update the tracked test results, they need to be
328*8975f5c5SAndroid Build Coastguard Workercopied from `localResults/` to `baseResults/`.  This can be done by
329*8975f5c5SAndroid Build Coastguard Workerthe `bump` shell script.
330*8975f5c5SAndroid Build Coastguard Worker
331*8975f5c5SAndroid Build Coastguard WorkerYou can add your own private list of tests, not tracked publicly, by using
332*8975f5c5SAndroid Build Coastguard Worker`localtestlist` to list non-tracked tests.  This is automatically read
333*8975f5c5SAndroid Build Coastguard Workerby `runtests` and included in the `diff` and `bump` process.
334*8975f5c5SAndroid Build Coastguard Worker
335*8975f5c5SAndroid Build Coastguard Worker## Programmatic Interfaces
336*8975f5c5SAndroid Build Coastguard Worker
337*8975f5c5SAndroid Build Coastguard WorkerAnother piece of software can programmatically translate shaders to an AST
338*8975f5c5SAndroid Build Coastguard Workerusing one of two different interfaces:
339*8975f5c5SAndroid Build Coastguard Worker* A new C++ class-oriented interface, or
340*8975f5c5SAndroid Build Coastguard Worker* The original C functional interface
341*8975f5c5SAndroid Build Coastguard Worker
342*8975f5c5SAndroid Build Coastguard WorkerThe `main()` in `StandAlone/StandAlone.cpp` shows examples using both styles.
343*8975f5c5SAndroid Build Coastguard Worker
344*8975f5c5SAndroid Build Coastguard Worker### C++ Class Interface (new, preferred)
345*8975f5c5SAndroid Build Coastguard Worker
346*8975f5c5SAndroid Build Coastguard WorkerThis interface is in roughly the last 1/3 of `ShaderLang.h`.  It is in the
347*8975f5c5SAndroid Build Coastguard Workerglslang namespace and contains the following, here with suggested calls
348*8975f5c5SAndroid Build Coastguard Workerfor generating SPIR-V:
349*8975f5c5SAndroid Build Coastguard Worker
350*8975f5c5SAndroid Build Coastguard Worker```cxx
351*8975f5c5SAndroid Build Coastguard Workerconst char* GetEsslVersionString();
352*8975f5c5SAndroid Build Coastguard Workerconst char* GetGlslVersionString();
353*8975f5c5SAndroid Build Coastguard Workerbool InitializeProcess();
354*8975f5c5SAndroid Build Coastguard Workervoid FinalizeProcess();
355*8975f5c5SAndroid Build Coastguard Worker
356*8975f5c5SAndroid Build Coastguard Workerclass TShader
357*8975f5c5SAndroid Build Coastguard Worker    setStrings(...);
358*8975f5c5SAndroid Build Coastguard Worker    setEnvInput(EShSourceHlsl or EShSourceGlsl, stage,  EShClientVulkan or EShClientOpenGL, 100);
359*8975f5c5SAndroid Build Coastguard Worker    setEnvClient(EShClientVulkan or EShClientOpenGL, EShTargetVulkan_1_0 or EShTargetVulkan_1_1 or EShTargetOpenGL_450);
360*8975f5c5SAndroid Build Coastguard Worker    setEnvTarget(EShTargetSpv, EShTargetSpv_1_0 or EShTargetSpv_1_3);
361*8975f5c5SAndroid Build Coastguard Worker    bool parse(...);
362*8975f5c5SAndroid Build Coastguard Worker    const char* getInfoLog();
363*8975f5c5SAndroid Build Coastguard Worker
364*8975f5c5SAndroid Build Coastguard Workerclass TProgram
365*8975f5c5SAndroid Build Coastguard Worker    void addShader(...);
366*8975f5c5SAndroid Build Coastguard Worker    bool link(...);
367*8975f5c5SAndroid Build Coastguard Worker    const char* getInfoLog();
368*8975f5c5SAndroid Build Coastguard Worker    Reflection queries
369*8975f5c5SAndroid Build Coastguard Worker```
370*8975f5c5SAndroid Build Coastguard Worker
371*8975f5c5SAndroid Build Coastguard WorkerFor just validating (not generating code), substitute these calls:
372*8975f5c5SAndroid Build Coastguard Worker
373*8975f5c5SAndroid Build Coastguard Worker```cxx
374*8975f5c5SAndroid Build Coastguard Worker    setEnvInput(EShSourceHlsl or EShSourceGlsl, stage,  EShClientNone, 0);
375*8975f5c5SAndroid Build Coastguard Worker    setEnvClient(EShClientNone, 0);
376*8975f5c5SAndroid Build Coastguard Worker    setEnvTarget(EShTargetNone, 0);
377*8975f5c5SAndroid Build Coastguard Worker```
378*8975f5c5SAndroid Build Coastguard Worker
379*8975f5c5SAndroid Build Coastguard WorkerSee `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more
380*8975f5c5SAndroid Build Coastguard Workerdetails. There is a block comment giving more detail above the calls for
381*8975f5c5SAndroid Build Coastguard Worker`setEnvInput, setEnvClient, and setEnvTarget`.
382*8975f5c5SAndroid Build Coastguard Worker
383*8975f5c5SAndroid Build Coastguard Worker### C Functional Interface (original)
384*8975f5c5SAndroid Build Coastguard Worker
385*8975f5c5SAndroid Build Coastguard WorkerThis interface is in roughly the first 2/3 of `ShaderLang.h`, and referred to
386*8975f5c5SAndroid Build Coastguard Workeras the `Sh*()` interface, as all the entry points start `Sh`.
387*8975f5c5SAndroid Build Coastguard Worker
388*8975f5c5SAndroid Build Coastguard WorkerThe `Sh*()` interface takes a "compiler" call-back object, which it calls after
389*8975f5c5SAndroid Build Coastguard Workerbuilding call back that is passed the AST and can then execute a back end on it.
390*8975f5c5SAndroid Build Coastguard Worker
391*8975f5c5SAndroid Build Coastguard WorkerThe following is a simplified resulting run-time call stack:
392*8975f5c5SAndroid Build Coastguard Worker
393*8975f5c5SAndroid Build Coastguard Worker```c
394*8975f5c5SAndroid Build Coastguard WorkerShCompile(shader, compiler) -> compiler(AST) -> <back end>
395*8975f5c5SAndroid Build Coastguard Worker```
396*8975f5c5SAndroid Build Coastguard Worker
397*8975f5c5SAndroid Build Coastguard WorkerIn practice, `ShCompile()` takes shader strings, default version, and
398*8975f5c5SAndroid Build Coastguard Workerwarning/error and other options for controlling compilation.
399*8975f5c5SAndroid Build Coastguard Worker
400*8975f5c5SAndroid Build Coastguard Worker### C Functional Interface (new)
401*8975f5c5SAndroid Build Coastguard Worker
402*8975f5c5SAndroid Build Coastguard WorkerThis interface is located `glslang_c_interface.h` and exposes functionality similar to the C++ interface. The following snippet is a complete example showing how to compile GLSL into SPIR-V 1.5 for Vulkan 1.2.
403*8975f5c5SAndroid Build Coastguard Worker
404*8975f5c5SAndroid Build Coastguard Worker```c
405*8975f5c5SAndroid Build Coastguard Worker#include <glslang/Include/glslang_c_interface.h>
406*8975f5c5SAndroid Build Coastguard Worker
407*8975f5c5SAndroid Build Coastguard Worker// Required for use of glslang_default_resource
408*8975f5c5SAndroid Build Coastguard Worker#include <glslang/Public/resource_limits_c.h>
409*8975f5c5SAndroid Build Coastguard Worker
410*8975f5c5SAndroid Build Coastguard Workertypedef struct SpirVBinary {
411*8975f5c5SAndroid Build Coastguard Worker    uint32_t *words; // SPIR-V words
412*8975f5c5SAndroid Build Coastguard Worker    int size; // number of words in SPIR-V binary
413*8975f5c5SAndroid Build Coastguard Worker} SpirVBinary;
414*8975f5c5SAndroid Build Coastguard Worker
415*8975f5c5SAndroid Build Coastguard WorkerSpirVBinary compileShaderToSPIRV_Vulkan(glslang_stage_t stage, const char* shaderSource, const char* fileName) {
416*8975f5c5SAndroid Build Coastguard Worker    const glslang_input_t input = {
417*8975f5c5SAndroid Build Coastguard Worker        .language = GLSLANG_SOURCE_GLSL,
418*8975f5c5SAndroid Build Coastguard Worker        .stage = stage,
419*8975f5c5SAndroid Build Coastguard Worker        .client = GLSLANG_CLIENT_VULKAN,
420*8975f5c5SAndroid Build Coastguard Worker        .client_version = GLSLANG_TARGET_VULKAN_1_2,
421*8975f5c5SAndroid Build Coastguard Worker        .target_language = GLSLANG_TARGET_SPV,
422*8975f5c5SAndroid Build Coastguard Worker        .target_language_version = GLSLANG_TARGET_SPV_1_5,
423*8975f5c5SAndroid Build Coastguard Worker        .code = shaderSource,
424*8975f5c5SAndroid Build Coastguard Worker        .default_version = 100,
425*8975f5c5SAndroid Build Coastguard Worker        .default_profile = GLSLANG_NO_PROFILE,
426*8975f5c5SAndroid Build Coastguard Worker        .force_default_version_and_profile = false,
427*8975f5c5SAndroid Build Coastguard Worker        .forward_compatible = false,
428*8975f5c5SAndroid Build Coastguard Worker        .messages = GLSLANG_MSG_DEFAULT_BIT,
429*8975f5c5SAndroid Build Coastguard Worker        .resource = glslang_default_resource(),
430*8975f5c5SAndroid Build Coastguard Worker    };
431*8975f5c5SAndroid Build Coastguard Worker
432*8975f5c5SAndroid Build Coastguard Worker    glslang_shader_t* shader = glslang_shader_create(&input);
433*8975f5c5SAndroid Build Coastguard Worker
434*8975f5c5SAndroid Build Coastguard Worker    SpirVBinary bin = {
435*8975f5c5SAndroid Build Coastguard Worker        .words = NULL,
436*8975f5c5SAndroid Build Coastguard Worker        .size = 0,
437*8975f5c5SAndroid Build Coastguard Worker    };
438*8975f5c5SAndroid Build Coastguard Worker    if (!glslang_shader_preprocess(shader, &input))	{
439*8975f5c5SAndroid Build Coastguard Worker        printf("GLSL preprocessing failed %s\n", fileName);
440*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_shader_get_info_log(shader));
441*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_shader_get_info_debug_log(shader));
442*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", input.code);
443*8975f5c5SAndroid Build Coastguard Worker        glslang_shader_delete(shader);
444*8975f5c5SAndroid Build Coastguard Worker        return bin;
445*8975f5c5SAndroid Build Coastguard Worker    }
446*8975f5c5SAndroid Build Coastguard Worker
447*8975f5c5SAndroid Build Coastguard Worker    if (!glslang_shader_parse(shader, &input)) {
448*8975f5c5SAndroid Build Coastguard Worker        printf("GLSL parsing failed %s\n", fileName);
449*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_shader_get_info_log(shader));
450*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_shader_get_info_debug_log(shader));
451*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_shader_get_preprocessed_code(shader));
452*8975f5c5SAndroid Build Coastguard Worker        glslang_shader_delete(shader);
453*8975f5c5SAndroid Build Coastguard Worker        return bin;
454*8975f5c5SAndroid Build Coastguard Worker    }
455*8975f5c5SAndroid Build Coastguard Worker
456*8975f5c5SAndroid Build Coastguard Worker    glslang_program_t* program = glslang_program_create();
457*8975f5c5SAndroid Build Coastguard Worker    glslang_program_add_shader(program, shader);
458*8975f5c5SAndroid Build Coastguard Worker
459*8975f5c5SAndroid Build Coastguard Worker    if (!glslang_program_link(program, GLSLANG_MSG_SPV_RULES_BIT | GLSLANG_MSG_VULKAN_RULES_BIT)) {
460*8975f5c5SAndroid Build Coastguard Worker        printf("GLSL linking failed %s\n", fileName);
461*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_program_get_info_log(program));
462*8975f5c5SAndroid Build Coastguard Worker        printf("%s\n", glslang_program_get_info_debug_log(program));
463*8975f5c5SAndroid Build Coastguard Worker        glslang_program_delete(program);
464*8975f5c5SAndroid Build Coastguard Worker        glslang_shader_delete(shader);
465*8975f5c5SAndroid Build Coastguard Worker        return bin;
466*8975f5c5SAndroid Build Coastguard Worker    }
467*8975f5c5SAndroid Build Coastguard Worker
468*8975f5c5SAndroid Build Coastguard Worker    glslang_program_SPIRV_generate(program, stage);
469*8975f5c5SAndroid Build Coastguard Worker
470*8975f5c5SAndroid Build Coastguard Worker    bin.size = glslang_program_SPIRV_get_size(program);
471*8975f5c5SAndroid Build Coastguard Worker    bin.words = malloc(bin.size * sizeof(uint32_t));
472*8975f5c5SAndroid Build Coastguard Worker    glslang_program_SPIRV_get(program, bin.words);
473*8975f5c5SAndroid Build Coastguard Worker
474*8975f5c5SAndroid Build Coastguard Worker    const char* spirv_messages = glslang_program_SPIRV_get_messages(program);
475*8975f5c5SAndroid Build Coastguard Worker    if (spirv_messages)
476*8975f5c5SAndroid Build Coastguard Worker        printf("(%s) %s\b", fileName, spirv_messages);
477*8975f5c5SAndroid Build Coastguard Worker
478*8975f5c5SAndroid Build Coastguard Worker    glslang_program_delete(program);
479*8975f5c5SAndroid Build Coastguard Worker    glslang_shader_delete(shader);
480*8975f5c5SAndroid Build Coastguard Worker
481*8975f5c5SAndroid Build Coastguard Worker    return bin;
482*8975f5c5SAndroid Build Coastguard Worker}
483*8975f5c5SAndroid Build Coastguard Worker```
484*8975f5c5SAndroid Build Coastguard Worker
485*8975f5c5SAndroid Build Coastguard Worker## Basic Internal Operation
486*8975f5c5SAndroid Build Coastguard Worker
487*8975f5c5SAndroid Build Coastguard Worker* Initial lexical analysis is done by the preprocessor in
488*8975f5c5SAndroid Build Coastguard Worker  `MachineIndependent/Preprocessor`, and then refined by a GLSL scanner
489*8975f5c5SAndroid Build Coastguard Worker  in `MachineIndependent/Scan.cpp`.  There is currently no use of flex.
490*8975f5c5SAndroid Build Coastguard Worker
491*8975f5c5SAndroid Build Coastguard Worker* Code is parsed using bison on `MachineIndependent/glslang.y` with the
492*8975f5c5SAndroid Build Coastguard Worker  aid of a symbol table and an AST.  The symbol table is not passed on to
493*8975f5c5SAndroid Build Coastguard Worker  the back-end; the intermediate representation stands on its own.
494*8975f5c5SAndroid Build Coastguard Worker  The tree is built by the grammar productions, many of which are
495*8975f5c5SAndroid Build Coastguard Worker  offloaded into `ParseHelper.cpp`, and by `Intermediate.cpp`.
496*8975f5c5SAndroid Build Coastguard Worker
497*8975f5c5SAndroid Build Coastguard Worker* The intermediate representation is very high-level, and represented
498*8975f5c5SAndroid Build Coastguard Worker  as an in-memory tree.   This serves to lose no information from the
499*8975f5c5SAndroid Build Coastguard Worker  original program, and to have efficient transfer of the result from
500*8975f5c5SAndroid Build Coastguard Worker  parsing to the back-end.  In the AST, constants are propagated and
501*8975f5c5SAndroid Build Coastguard Worker  folded, and a very small amount of dead code is eliminated.
502*8975f5c5SAndroid Build Coastguard Worker
503*8975f5c5SAndroid Build Coastguard Worker  To aid linking and reflection, the last top-level branch in the AST
504*8975f5c5SAndroid Build Coastguard Worker  lists all global symbols.
505*8975f5c5SAndroid Build Coastguard Worker
506*8975f5c5SAndroid Build Coastguard Worker* The primary algorithm of the back-end compiler is to traverse the
507*8975f5c5SAndroid Build Coastguard Worker  tree (high-level intermediate representation), and create an internal
508*8975f5c5SAndroid Build Coastguard Worker  object code representation.  There is an example of how to do this
509*8975f5c5SAndroid Build Coastguard Worker  in `MachineIndependent/intermOut.cpp`.
510*8975f5c5SAndroid Build Coastguard Worker
511*8975f5c5SAndroid Build Coastguard Worker* Reduction of the tree to a linear byte-code style low-level intermediate
512*8975f5c5SAndroid Build Coastguard Worker  representation is likely a good way to generate fully optimized code.
513*8975f5c5SAndroid Build Coastguard Worker
514*8975f5c5SAndroid Build Coastguard Worker* There is currently some dead old-style linker-type code still lying around.
515*8975f5c5SAndroid Build Coastguard Worker
516*8975f5c5SAndroid Build Coastguard Worker* Memory pool: parsing uses types derived from C++ `std` types, using a
517*8975f5c5SAndroid Build Coastguard Worker  custom allocator that puts them in a memory pool.  This makes allocation
518*8975f5c5SAndroid Build Coastguard Worker  of individual container/contents just few cycles and deallocation free.
519*8975f5c5SAndroid Build Coastguard Worker  This pool is popped after the AST is made and processed.
520*8975f5c5SAndroid Build Coastguard Worker
521*8975f5c5SAndroid Build Coastguard Worker  The use is simple: if you are going to call `new`, there are three cases:
522*8975f5c5SAndroid Build Coastguard Worker
523*8975f5c5SAndroid Build Coastguard Worker  - the object comes from the pool (its base class has the macro
524*8975f5c5SAndroid Build Coastguard Worker    `POOL_ALLOCATOR_NEW_DELETE` in it) and you do not have to call `delete`
525*8975f5c5SAndroid Build Coastguard Worker
526*8975f5c5SAndroid Build Coastguard Worker  - it is a `TString`, in which case call `NewPoolTString()`, which gets
527*8975f5c5SAndroid Build Coastguard Worker    it from the pool, and there is no corresponding `delete`
528*8975f5c5SAndroid Build Coastguard Worker
529*8975f5c5SAndroid Build Coastguard Worker  - the object does not come from the pool, and you have to do normal
530*8975f5c5SAndroid Build Coastguard Worker    C++ memory management of what you `new`
531*8975f5c5SAndroid Build Coastguard Worker
532*8975f5c5SAndroid Build Coastguard Worker* Features can be protected by version/extension/stage/profile:
533*8975f5c5SAndroid Build Coastguard Worker  See the comment in `glslang/MachineIndependent/Versions.cpp`.
534*8975f5c5SAndroid Build Coastguard Worker
535*8975f5c5SAndroid Build Coastguard Worker[cmake]: https://cmake.org/
536*8975f5c5SAndroid Build Coastguard Worker[python]: https://www.python.org/
537*8975f5c5SAndroid Build Coastguard Worker[bison]: https://www.gnu.org/software/bison/
538*8975f5c5SAndroid Build Coastguard Worker[googletest]: https://github.com/google/googletest
539*8975f5c5SAndroid Build Coastguard Worker[bison-gnu-win32]: http://gnuwin32.sourceforge.net/packages/bison.htm
540*8975f5c5SAndroid Build Coastguard Worker[main-tot-release]: https://github.com/KhronosGroup/glslang/releases/tag/main-tot
541