GLSLANGVALIDATOR(1)
π glslangValidator β the OpenGL (ES) Shading Language Reference Compiler π
okay bestie, listen. this one's from the General Commands Manual (section 1, so it's a command, not some library thing), and it's literally the official reference compiler front end. let's get into it π¦
β¨ SYNOPSIS β¨
glslangValidator [OPTION]... [FILE]...
like, options, then files. that's the whole vibe. π
πΈ DESCRIPTION πΈ
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 these languages, no chill, no vibes-based leniency. it's open and free for anyone to use, either from a command line or programmatically. and the OpenGL and OpenGL ES working groups are committed to maintaining consistency between the reference compiler and the corresponding shading language specifications. iconic behavior tbh π
the whole point of the reference compiler is to identify shader portability issues. here's the tea:
- if
glslangaccepts a shader without errors, then all OpenGL and OpenGL ES implementations claiming to support the shader's language version should also accept the shader without errors. no cap. - likewise, if
glslangreports an error when compiling a shader, all OpenGL and OpenGL ES implementations for that language version should report errors too β unless theglslangerrors are caused by differences in implementation-defined limits or extension support. (so like, sometimes it's not the shader's fault, it's the limits' fault π)
Glslang can also be used to generate SPIR-V from GLSL. but bestie, hear me β this feature is experimental and non-optimized. it's giving "it works but don't make it your whole personality." π
π FILE π
the file extension of FILE results in auto-stage classification. the compiler just knows. iykyk.
.confβ to provide a config file that replaces the default configuration (see 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 β
this is the main character section. buckle up. π
-Cβ cascading errors; risk crash from accumulation of error recoveries. yes, that's the actual warning. it's giving chaotic energy. β οΈ-Dβ input is HLSL-D<macro=def>β (define a pre-processor macro)-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 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 to a.conffile).-dβ default to desktop (#version 110) when there is no shader#version(default is ES version 100).-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 lacking'location'(fragile, not cross stage). β οΈ fragile bestie, it said it not me--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]...β per-descriptor-set shift values--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 from stdin instead of from a file. You'll have to provide the shader stage using-S. (yes, it literally says "stageusing". we keep it, character for character π)--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>
bestie reminder:-Ecannot be used with-l,-Odmay cause illegal SPIR-V for HLSL,--auto-map-locationsis fragile and not cross stage, and the SPIR-V generation feature in general is experimental and non-optimized. slay responsibly. π
π¦ ALSO SEE π¦
https://github.com/KhronosGroup/glslanghttps://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
that's the whole page, you ate it π go forth and validate those shaders.
this was glslangValidator, from the General Commands Manual, version/date December 2017 (page id GLSLANGVALIDATOR(1)) β love u, bye πβ¨
π¦ where this page comes from
- debian bookworm: glslang-tools 12.0.0-2 Β· BSD-3-Clause
- ubuntu jammy: glslang-tools 11.8.0+1.3.204.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