-
John Kessenich authoredf0928b3f
Also see the Khronos landing page for glslang as a reference front end:
https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
The above page includes where to get binaries, and is kept up to date regarding the feature level of glslang.
glslang
An OpenGL and OpenGL ES shader front end and validator.
There are several components:
-
A GLSL/ESSL front-end for reference validation and translation of GLSL/ESSL into an AST.
-
An HLSL front-end for translation of a broad generic HLL into the AST. See issue 362 and issue 701 for current status.
-
A SPIR-V back end for translating the AST to SPIR-V.
-
A standalone wrapper,
glslangValidator
, that can be used as a command-line tool for the above.
How to add a feature protected by a version/extension/stage/profile: See the
comment in glslang/MachineIndependent/Versions.cpp
.
Tasks waiting to be done are documented as GitHub issues.
Execution of Standalone Wrapper
To use the standalone binary form, execute glslangValidator
, and it will print
a usage statement. Basic operation is to give it a file containing a shader,
and it will print out warnings/errors and optionally an AST.
The applied stage-specific rules are based on the file extension:
-
.vert
for a vertex shader -
.tesc
for a tessellation control shader -
.tese
for a tessellation evaluation shader -
.geom
for a geometry shader -
.frag
for a fragment shader -
.comp
for a compute shader
There is also a non-shader extension
-
.conf
for a configuration file of limits, see usage statement for example
Building
Instead of building manually, you can also download the binaries for your platform directly from the master-tot release on GitHub. Those binaries are automatically uploaded by the buildbots after successful testing and they always reflect the current top of the tree of the master branch.
Dependencies
- A C++11 compiler. (For MSVS: 2015 is recommended, 2013 is fully supported/tested, and 2010 support is attempted, but not tested.)
- CMake: for generating compilation targets.
- make: Linux, ninja is an alternative, if configured.
- Python 2.7: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools.)
- bison: optional, but needed when changing the grammar (glslang.y).
- googletest: optional, but should use if making any changes to glslang.