GLSLANGVALIDATOR(1)

πŸ“¦ version 12.0.0, in debian bookworm, ubuntu jammy

πŸ’– 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 glslang accepts 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 glslang reports an error when compiling a shader, all OpenGL and OpenGL ES implementations for that language version should report errors too β€” unless the glslang errors 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 -c option 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 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, and --target-env for 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 are vert, tesc, tese, geom, frag, or comp.
  • -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 (-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, and --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> β€” 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 -V and -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 a uint32_t array named name initialized with the shader binary code.
  • --vn <name> β€” synonym for --variable-name <name>
bestie reminder: -E cannot be used with -l, -Od may cause illegal SPIR-V for HLSL, --auto-map-locations is fragile and not cross stage, and the SPIR-V generation feature in general is experimental and non-optimized. slay responsibly. πŸ’…

πŸ¦‹ ALSO SEE πŸ¦‹


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