Usage: glslang [option]... [file]...
'file' with one of the following three endings can be auto-classified:
1) .<stage>, where <stage> is one of:
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
mesh for a mesh shader
task for a task shader
rgen for a ray generation shader
rint for a ray intersection shader
rahit for a ray any hit shader
rchit for a ray closest hit shader
rmiss for a ray miss shader
rcall for a ray callable shader
2) .<stage>.glsl or .<stage>.hlsl compound suffix, where stage options are
described above
3) .conf, to provide a config file that replaces the default configuration (see
-c option below for generating a template)
Options:
-C cascading errors; risk crash from accumulation of error recoveries
-D input is HLSL (this is the default when any suffix is .hlsl)
-D<name[=def]> | --D <name[=def]> | --define-macro <name[=def]>
define a pre-processor macro
-E print pre-processed GLSL; cannot be used with -l; errors will
appear on stderr
-G[ver] create SPIR-V binary under OpenGL semantics; turns on -l; default
file name is <stage>.spv (-o overrides this); ver, when present,
is the version of the input semantics which will appear in
'#define GL_SPIRV ver'; --client opengl100 is the same as -G100; a
--target-env for OpenGL will also imply -G; currently only
supports GLSL
-H print human readable form of SPIR-V; turns on -V
-I<dir> add <dir> to the include search path; includer's directory is
searched first, followed by left-to-right order of -I
-O optimizes SPIR-V for performance
-Os optimizes SPIR-V to minimize size
-Od disables optimization; may cause illegal SPIR-V for HLSL
-P<text> | --P <text> | --preamble-text <text>
inject custom preamble text which is treated as if it appeared
immediately after the version declaration (if any)
-R use relaxed verification rules for generating Vulkan SPIR-V,
allowing the use of default uniforms, atomic_uints, and the
gl_VertexID and gl_InstanceID keywords
-S <stage> uses the specified <stage> rather than parsing the file extension;
choices for <stage> include vert, tesc, tese, geom, frag, and
comp; a full list of options is given above
-U<name> | --undef-macro <name> | --U <name>
undefine a pre-processor macro
-V[ver] create SPIR-V binary under Vulkan semantics; turns on -l; default
file name is <stage>.spv (-o overrides this); ver, when present,
is the version of the input semantics which will appear in
'#define VULKAN ver'; --client vulkan100 is the same as -V100; a
'--target-env' for Vulkan will also imply '-V'
-c configuration dump; creates the default configuration file
(redirect to a .conf file)
-d default to desktop (#version 110) when there is no shader #version
(default is ES version 100)
-e <name> | --entry-point <name>
specify <name> as the entry-point function name
-f{hlsl_functionality1}
'hlsl_functionality1' enables use of the
SPV_GOOGLE_hlsl_functionality1 extension
-g generate debug information
-g0 strip debug information
-gV generate nonsemantic shader debug information
-gVS generate nonsemantic shader debug information with source
-h | --help 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; requires -l for linking
-r | --relaxed-errors
relaxed GLSL semantic error-checking mode
-s silence syntax and semantic error reporting
-t multi-threaded mode
-u<name>:<loc>
specify a uniform location override for --aml
-v | --version
print version strings
-w | --suppress-warnings
suppress GLSL warnings, except as required by '#extension : warn'
-x save binary output as text-based 32-bit hexadecimal numbers
--absolute-path prints absolute path for messages
--relax-set-binding-limits allow larger layout(set) and
layout(binding) values
--auto-map-binding | --auto-map-bindings | --amb
automatically bind uniform variables without
explicit bindings
--auto-map-locations | --aml automatically locate input/output lacking
'location' (fragile, not cross stage)
--auto-sampled-textures removes sampler variables and converts
existing textures to sampled textures
--client {vulkan<ver> | opengl<ver>}
see -V and -G
--depfile <file> writes depfile for build systems
--discard-is-terminate map GLSL discard to OpTerminateInvocation
instead of OpDemoteToHelperInvocation
--dump-builtin-symbols prints builtin symbol table prior each
compile
-dumpfullversion | -dumpversion print bare major.minor.patchlevel
--enhanced-msgs print more readable error messages (GLSL
only)
--error-column display the column of the error along the
line
--flatten-uniform-array | --flatten-uniform-arrays | --fua
flatten uniform texture/sampler arrays to
scalars
--glsl-version {100 | 110 | 120 | 130 | 140 | 150 |
300es | 310es | 320es | 330 |
400 | 410 | 420 | 430 | 440 | 450 | 460}
set GLSL version; overrides #version in
shader source
--hlsl-dx-position-w W component of SV_Position in HLSL fragment
shaders compatible with DirectX
--hlsl-dx9-compatible interprets sampler declarations as a
texture/sampler combo like DirectX9 would,
and recognizes DirectX9-specific semantics
--hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL
--hlsl-iomap | --hlsl-iomapper | --hlsl-iomapping
perform IO mapping in HLSL register space
--hlsl-offsets allow block offsets to follow HLSL rules;
works independently of source language
--invert-y | --iy invert position.Y output in vertex shader
--keep-uncalled | --ku don't eliminate uncalled functions
--lto perform link time optimization
--nan-clamp favor non-NaN operand in min, max, and clamp
--no-link only compile shader; do not link (GLSL only)
NOTE: this option will set the export
linkage attribute on all functions
--no-storage-format | --nsf use Unknown image format
--quiet do not print anything to stdout unless
requested by another option
--reflect-all-block-variables reflect all variables in blocks, whether
inactive or active
--reflect-basic-array-suffix arrays of basic types will have trailing [0]
--reflect-intermediate-io reflection includes inputs/outputs of linked
shaders rather than just vertex/fragment
--reflect-separate-buffers reflect buffer variables and blocks
separately to uniforms
--reflect-strict-array-suffix use strict array suffix rules when
reflecting
--reflect-unwrap-io-blocks unwrap input/output blocks the same as
uniform blocks
--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
--resource-set-bindings | --rsb synonyms for --resource-set-binding
--set-atomic-counter-block <name> <set>
set name and descriptor set for atomic
counter blocks with -R opt
--sacb synonym for set-atomic-counter-block
--set-block-backing name {uniform | buffer | push_constant}
changes the backing type of a uniform,
buffer, or push_constant block declared in
the program when using the -R option; this
can be used to change the backing for
existing blocks as well as implicit ones
such as 'gl_DefaultUniformBlock'
--set-default-uniform-block <name> <set> <binding>
set name, descriptor set, and binding for
global default-uniform-block with -R opt
--sdub synonym for set-default-uniform-block
--shift-image-binding [stage] <num>
base binding number for images (UAV)
--shift-image-binding [stage] <num> <set>...
per-descriptor-set shift values
--shift-image-bindings | --sib synonyms 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
--shift-sampler-bindings | --ssb synonyms 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
--shift-ssbo-bindings | --sbb synonyms 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
--shift-texture-bindings | --stb synonyms 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
--shift-uav-bindings | --suavb synonyms 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-ubo-bindings | --sub |
--shift-cbuffer-binding | --shift-cbuffer-bindings | --scb
synonyms for --shift-ubo-binding
--shift-combined-sampler-binding [stage] <num>
base binding number for combined samplers
--shift-combined-sampler-binding [stage] <num> <set>...
per-descriptor-set shift values
--shift-combined-sampler-bindings | --scsb
synonyms for --shift-combined-sampler-binding
--shift-as-binding [stage] <num>
base binding number for acceleration structures
--shift-as-binding [stage] <num> <set>...
per-descriptor-set shift values
--shift-as-bindings | --sab
synonyms for --shift-as-binding
--spirv-dis output standard-form disassembly; works only
when a SPIR-V generation option is also used
--spirv-val execute the SPIRV-Tools validator
--source-entrypoint <name> | --sep <name>
the given shader source function is renamed
to be the <name> given in -e
--stdin read from stdin instead of from a file;
requires providing the shader stage using -S
--target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | vulkan1.3 | vulkan1.4 |
opengl | spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 |
spirv1.4 | spirv1.5 | spirv1.6}
set the execution environment the generated
code will be executed in; defaults to:
* vulkan1.0 under --client vulkan<ver>
* opengl under --client opengl<ver>
* spirv1.0 under --target-env vulkan1.0
* spirv1.3 under --target-env vulkan1.1
* spirv1.5 under --target-env vulkan1.2
* spirv1.6 under --target-env vulkan1.3
* spirv1.6 under --target-env vulkan1.4
multiple --target-env can be specified
--uniform-base <base> set a base to use for generated uniform
locations
--variable-name <name> | --vn <name>
creates a C header file that contains a
uint32_t array named <name> initialized with
the shader binary code
--validate-io validate cross stage IO
--bindings-per-resource-type
Options (68)
| Option | Description | Source |
|---|---|---|
-C | cascading errors; | help |
-D | input is HLSL (this is the default when any suffix is .hlsl) | help |
-E | print pre-processed GLSL; | help |
-G ver | create SPIR-V binary under OpenGL semantics; | help |
-H | print human readable form of SPIR-V; | help |
-I dir | add <dir> to the include search path; | help |
-O | optimizes SPIR-V for performance | help |
-Os | optimizes SPIR-V to minimize size | help |
-Od | disables optimization; | help |
-R | use relaxed verification rules for generating Vulkan SPIR-V, allowing the use of default uniforms, atomic_uints, and the gl_VertexID and gl_InstanceID keywords | help |
-S stage | uses the specified <stage> rather than parsing the file extension; | help |
-V ver | create SPIR-V binary under Vulkan semantics; | help |
-c | configuration dump; | help |
-d | default to desktop (#version 110) when there is no shader #version (default is ES version 100) | help |
-g | generate debug information | help |
-g0 | strip debug information | help |
-gV | generate nonsemantic shader debug information | help |
-gVS | generate nonsemantic shader debug information with source | help |
-i | intermediate tree (glslang AST) is printed out | help |
-l | link all input files together to form a single module | help |
-m | memory leak mode | help |
-o file | save binary to <file>; | help |
-q | dump reflection query database; | help |
-s | silence syntax and semantic error reporting | help |
-t | multi-threaded mode | help |
-u name>:<loc | specify a uniform location override for --aml | help |
-x | save binary output as text-based 32-bit hexadecimal numbers | help |
--absolute-path | prints absolute path for messages | help |
--relax-set-binding-limits | allow larger layout(set) and layout(binding) values | help |
--auto-map-locations, --aml | automatically locate input/output lacking 'location' (fragile, not cross stage) | help |
--auto-sampled-textures | removes sampler variables and converts existing textures to sampled textures | help |
--depfile file | writes depfile for build systems | help |
--discard-is-terminate | map GLSL discard to OpTerminateInvocation instead of OpDemoteToHelperInvocation | help |
--dump-builtin-symbols | prints builtin symbol table prior each compile | help |
-dumpfullversion, -dumpversion | print bare major.minor.patchlevel | help |
--enhanced-msgs | print more readable error messages (GLSL only) | help |
--error-column | display the column of the error along the line | help |
--hlsl-dx-position-w | W component of SV_Position in HLSL fragment shaders compatible with DirectX | help |
--hlsl-dx9-compatible | interprets sampler declarations as a texture/sampler combo like DirectX9 would, and recognizes DirectX9-specific semantics | help |
--hlsl-enable-16bit-types | allow 16-bit types in SPIR-V for HLSL | help |
--hlsl-offsets | allow block offsets to follow HLSL rules; | help |
--invert-y, --iy | invert position.Y output in vertex shader | help |
--keep-uncalled, --ku | don't eliminate uncalled functions | help |
--lto | perform link time optimization | help |
--nan-clamp | favor non-NaN operand in min, max, and clamp | help |
--no-link | only compile shader; | help |
--no-storage-format, --nsf | use Unknown image format | help |
--quiet | do not print anything to stdout unless requested by another option | help |
--reflect-all-block-variables | reflect all variables in blocks, whether inactive or active | help |
--reflect-basic-array-suffix | arrays of basic types will have trailing [0] | help |
--reflect-intermediate-io | reflection includes inputs/outputs of linked shaders rather than just vertex/fragment | help |
--reflect-separate-buffers | reflect buffer variables and blocks separately to uniforms | help |
--reflect-strict-array-suffix | use strict array suffix rules when reflecting | help |
--reflect-unwrap-io-blocks | unwrap input/output blocks the same as uniform blocks | help |
--resource-set-bindings, --rsb | synonyms for --resource-set-binding | help |
--sacb | synonym for set-atomic-counter-block | help |
--sdub | synonym for set-default-uniform-block | help |
--shift-image-bindings, --sib | synonyms for --shift-image-binding | help |
--shift-sampler-bindings, --ssb | synonyms for --shift-sampler-binding | help |
--shift-ssbo-bindings, --sbb | synonyms for --shift-ssbo-binding | help |
--shift-texture-bindings, --stb | synonyms for --shift-texture-binding | help |
--shift-uav-bindings, --suavb | synonyms for --shift-uav-binding | help |
--spirv-dis | output standard-form disassembly; | help |
--spirv-val | execute the SPIRV-Tools validator | help |
--stdin | read from stdin instead of from a file; | help |
--uniform-base base | set a base to use for generated uniform locations | help |
--validate-io | validate cross stage IO | help |
--bindings-per-resource-type | help |