GLSLANG(1)
β¨ NAME β¨
glslang β the OpenGL (ES) Shading Language Reference Compiler π
β¨
π¦ SYNOPSIS π¦
glslang [OPTION]... [FILE]...
π DESCRIPTION π
okay so bestie, glslang is the official reference compiler front end for the OpenGL ES and OpenGL shading languages π. It implements a strict interpretation of the specs for those languages. It's open and free for literally anyone to use β from a command line or programmatically, your call π«Ά. And the OpenGL and OpenGL ES working groups are committed to keeping consistency between the reference compiler and the corresponding shading language specifications. iconic behavior, honestly.
The whole point of the reference compiler is to sniff out shader portability issues π΅οΈβοΈ. Like: if glslang accepts a shader with zero errors, then every OpenGL and OpenGL ES implementation claiming to support that shader's language version should also accept it with zero errors. Fr fr. And flip side β if glslang reports an error while compiling a shader, then all OpenGL and OpenGL ES implementations for that language version should report errors too, unless the glslang errors come from differences in implementation-defined limits or extension support. iykyk π
glslang can also generate SPIR-V from GLSL π. But heads up: this feature is experimental and non-optimized π. Not me warning you twice, it's in the spec.
πΈ FILE πΈ
the file extension of FILE decides the auto-stage classification for you, no cap:
.confβ to provide a config file that replaces the default configuration (peep the-coption below for generating a template π).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
π₯ OPTIONS π₯
-Cβ cascading errors; risk crash from accumulation of error recoveries π be careful bestie-Dβ input is HLSL-D<macro=def>,-D<macro>β define a pre-processor macro β¨-Eβ print pre-processed GLSL; cannot be used with-l; errors will appear onstderr.-G[ver]β create SPIR-V binary, under OpenGL semantics; turns on-l; default file name is<stage>.spv(-ooverrides this).ver, when present, is the version of the input semantics, which will appear in#define GL_SPIRV ver.--client opengl100is the same as-G100, and--target-envfor OpenGL will also imply-Gπ-Hβ print human readable form of SPIR-V; turns on-V-I<dir>β add dir to the include search path; the includer's directory is searched first, followed by left-to-right order of-Iπ-Odβ disables optimization. May cause illegal SPIR-V for HLSL. π-Osβ optimizes SPIR-V to minimize size π±-S <stage>β uses the specified stage rather than parsing the file extension. choices for stage arevert,tesc,tese,geom,frag, orcomp-U<macro>β undefine a pre-processor macro π-V[ver]β create SPIR-V binary, under Vulkan semantics; turns on-l; default file name is<stage>.spv(-ooverrides this).ver, when present, is the version of the input semantics, which will appear in#define VULKAN ver.--client vulkan100is the same as-V100, and--target-envfor Vulkan will also imply-Vπ₯-cβ configuration dump; creates the default configuration file (redirect it to a.conffile π)-dβ default to desktop (#version 110) when there is no shader#version(default is ES version100)-e <name>β specify name as the entry-point name β¨-gβ generate debug information π-hβ print this usage message-iβ intermediate tree (glslang AST) is printed out π³-lβ link all input files together to form a single module π«Ά-mβ memory leak mode-o <file>β save binary to file, requires a binary option (e.g.,-V) πΎ-qβ dump reflection query database-rβ synonym for--relaxed-errors-sβ silence syntax and semantic error reporting π€«-tβ multi-threaded mode π§΅-vβ print version strings-wβ synonym for--suppress-warnings-xβ save binary output as text-based 32-bit hexadecimal numbers π’--auto-map-bindingsβ automatically bind uniform variables without explicit bindings β¨--ambβ synonym for--auto-map-bindings--auto-map-locationsβ automatically locate input/output lackinglocation(fragile, not cross stage) π¬--amlβ synonym for--auto-map-locations--client {vulkan<ver>|opengl<ver>}β see-Vand-G--flatten-uniform-arraysβ flatten uniform texture/sampler arrays to scalars π«--fuaβ synonym for--flatten-uniform-arrays--hlsl-offsetsβ allow block offsets to follow HLSL rules. Works independently of source language--hlsl-iomapβ perform IO mapping in HLSL register space--keep-uncalledβ don't eliminate uncalled functions π«Ά--kuβ synonym for--keep-uncalled--no-storage-formatβ use Unknown image format--nsfβ synonym for--no-storage-format--relaxed-errorsβ relaxed GLSL semantic error-checking mode π--resource-set-binding [stage] name set bindingβ set descriptor set and binding for individual resources--resource-set-binding [stage] setβ set descriptor set for all resources--rsb [stage] type set bindingβ synonym for--resource-set-binding--shift-image-binding [stage] numβ base binding number for images (uav)--shift-image-binding [stage] [num set]...β per-descriptor-set shift values--sib [stage] numβ synonym for--shift-image-binding--shift-sampler-binding [stage] numβ base binding number for samplers--shift-sampler-binding [stage] [num set]...β per-descriptor-set shift values--ssb [stage] numβ synonym for--shift-sampler-binding--shift-ssbo-binding [stage] numβ base binding number for SSBOs--shift-ssbo-binding [stage] [num set]...β per-descriptor-set shift values--sbb [stage] numβ synonym for--shift-ssbo-binding--shift-texture-binding [stage] numβ base binding number for textures--shift-texture-binding [stage] [num set]...β per-descriptor-set shift values--stb [stage] numβ synonym for--shift-texture-binding--shift-uav-binding [stage] numβ base binding number for UAVs--shift-uav-binding [stage] [num set]...β per-descriptor-set shift values--suavb [stage] numβ synonym for--shift-uav-binding--shift-UBO-binding [stage] numβ base binding number for UBOs--shift-UBO-binding [stage] [num set]...β per-descriptor-set shift values--shift-cbuffer-binding [stage] numβ synonym for--shift-UBO-binding--shift-cbuffer-binding [stage] [num set]...β synonym for--shift-UBO-binding--sub [stage] numβ synonym for--shift-UBO-binding--source-entrypoint <name>β the given shader source function is renamed to be the name given in-eπ--sepβ synonym for--source-entrypoint--stdinβ read fromstdininstead of from a file. You'll have to provide the shader stage using-S. π«Ά--suppress-warningsβ suppress GLSL warnings (except as required by#extension : warn) π€«--target-env {vulkan1.0|opengl}β set the execution environment code will execute in (as opposed to language semantics selected by--client). defaults:'vulkan1.0'under--client vulkan<ver>,'opengl'under--client opengl<ver>--variable-name <name>β creates a C header file that contains auint32_tarray named name initialized with the shader binary code π--vn <name>β synonym for--variable-name <name>
π ALSO SEE π
https://github.com/KhronosGroup/glslanghttps://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
and that's the whole page bestie π this one's from the glslang manual, dated December 2017, straight out of the General Commands Manual β go compile something gorgeous πβ¨π
π¦ where this page comes from
- debian trixie: glslang-tools 15.1.0+1.4.309.0-1 Β· BSD-3-Clause
- ubuntu noble: glslang-tools 14.0.0-2 Β· BSD-3-Clause
- ubuntu noble: glslang-tools 15.1.0-2~ubuntu0.24.04.2 Β· BSD-3-Clause
- ubuntu questing: glslang-tools 15.4.0-1
- ubuntu resolute: glslang-tools 16.2.0-2 Β· BSD-3-Clause
- ubuntu stonking: glslang-tools 16.4.0-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms