#wgsl #shader #graphics #gamedev #wgpu #command-line-tool #name

bin+lib wgsl-minifier

A command-line tool for minifying WGSL shaders

8 unstable releases (3 breaking)

0.4.1 Mar 11, 2024
0.4.0 Feb 28, 2024
0.3.2 Nov 20, 2023
0.2.0 Nov 2, 2023
0.1.2 Aug 2, 2023

#1082 in Game dev

Download history 30/week @ 2024-01-10 15/week @ 2024-01-17 8/week @ 2024-02-14 2/week @ 2024-02-21 150/week @ 2024-02-28 119/week @ 2024-03-06 66/week @ 2024-03-13 17/week @ 2024-03-20 13/week @ 2024-03-27 28/week @ 2024-04-03

66 downloads per month
Used in 3 crates (via naga-to-tokenstream)

MIT license

16KB
308 lines

WGSL Minifier

crates.io docs.rs crates.io

A small tool built on top of Naga that makes WGSL shaders smaller by performing simple dead code elimination, stripping names of non-exported functions and local variables, and removing as much whitespace as possible.

Usage

To minify your WGSL shader, simply run the following:

cargo install wgsl-minifier
wgsl-minifier path/to/your/shader.wgsl path/to/minified/output.wgsl

Dependencies

~5–15MB
~166K SLoC