SPIRV-REMAP(1)
π
SPIRV-REMAP β ok bestie, let's talk about spirv-remap(1)
Like, this is a General Commands Manual page, and it's about a utility that squishes SPIR-V binaries. Sit down, hydrate, let's go. β¨
πΈ NAME πΈ
spirv-remap β a utility to compress of SPIR-V binary files π
(yes, the original says "to compress of". I don't make the rules, I just report them. periodt.)
π¦ SYNOPSIS π¦
spirv-remap [OPTION]...
That's it. That's the whole vibe. Options only, no positional drama. π
β¨ DESCRIPTION β¨
Okay so spirv-remap is a utility that makes SPIR-V binary files compress better by reducing entropy. It can also optionally strip debug info and do load/store optimization, if you're feeling spicy. It transforms SPIR-V to SPIR-V, and along the way it remaps IDs. π
And here's the tea: the resulting modules have an increased ID range β like, IDs are not as tightly packed around zero anymore. Sounds bad? Nope, it's giving glow up. Because when you compress multiple modules together, they compress better, since the compressor's dictionary can find better cross-module commonality. Cross-module commonality is the friend group of compression, fr fr. π«Ά
The way remapping works is via canonicalization. Which means you can compress modules one at a time with no loss of quality compared to operating on a whole pile of modules at once. Iconic. The command line tool only handles multiple modules in the trivial repetition sense, purely for ease of use. The remapper API? It only accepts a single module at a time. One at a time. Boundaries. π§
β οΈ Real talk: spirv-remap is currently in an alpha state. There are no known remapping defects, but it has only been exercised on one real world game shader workload. So like, it's a talented baby. Be gentle. π
π₯ OPTIONS π₯
-?--helpβ shows help. the classic cry for guidance π-V--versionβ shows version. who are you, really β¨-v-vv...--verbose [int]β sets verbosity. And listen: with no verbosity, the command is silent. no thoughts, head empty, zero output π€«-i--input file1 [file2...]β files to process. feed it the files bestie π-o--output DESTDIRβ output directory. where the glow-up gets delivered π¦-s--strip-all--strip allβ strips all debug info. goodbye secrets π--map (all|types|names|funcs)β canonicalizes type IDs / named data / function bodies. pick your fighter π--dce (all|types|funcs)β removes dead types / functions. rip to them but they're different π--opt (all|loadstore)β optimizes unneeded loads/stores. waste not want not π--do-everythingβ Synonym for--map all --dce all --opt all --strip all. the full send. main character energy only β
π RETURNS π
0on success β slay β- a positive integer error on failure β not slay, but informative β
π EXAMPLES π
Example one β the remap moment:
spirv-remap -v --map all --input *.spv --output /tmp/out_dir
Perform ID remapping on all shaders in "*.spv", writing new files with the same basenames to /tmp/out_dir. cute, clean, basenames preserved, no chaos. π«Ά
Example two β the everything bagel:
spirv-remap-linux-64 -v --do-everything --input *.spv --output /tmp/out_dir
Perform all possible size reductions. maximum shrinkage. π₯
Note that
(that's it. that's the whole note. the original page literally just says "Note that" and then stops. I am not making this up. the sentence never arrives. it's giving cliffhanger. ππ)
π ALSO SEE π
π§ Sign-off π§
That's the page, bestie β it came from User Commands, dated December 2017, and it lives under the name SPIRV-REMAP(1). Go compress something and make it tiny and gorgeous. byeee πβ¨π
π¦ where this page comes from
- debian bookworm: glslang-tools 12.0.0-2 Β· BSD-3-Clause
- debian trixie: glslang-tools 15.1.0+1.4.309.0-1 Β· BSD-3-Clause
- ubuntu jammy: glslang-tools 11.8.0+1.3.204.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