A work in progress!
This project implements the necessary tools to build complex shaders, like what naga_oil does for bevy, but in a framework-agnostic way. At wgsl-tooling-wg we aim at standardizing a few language extensions to facilitate the work of engine developers and shader wizards.
Current and planned extensions: imports, conditional compilation, generics, modules.
This project can be used as a rust library or as a standalone CLI.
- Install
cargo install --git https://github.com/wgsl-tooling-wg/wesl-rs
- Compile a WESL shader
wesl compile <entrypoint.wgsl>
- Run eval()
wesl eval <entrypoint.wgsl> <expression to eval>
Refer to the crate documentation on docs.rs.
update: 2025-01
We are working towards an MVP release planned for 2025 Q1. It includes imports, conditional compilation and packaging.
The crate wgsl-parse contains a WGSL-compliant syntax tree and parser, with optional syntax extensions from the WESL specification.
The crate wesl contains an implementation of the WESL specification, i.e. a compiler that takes WESL files and generates valid WGSL.
- "conditional translation" 100%
- "imports" 90%
- "packaging" 80%
- "generics" 50%
- "modules" 50%
- eval/exec: 70%
- WESL validator: 10%
- WGSL optimization / compatibility: 10%
This crate contains a CLI to run the compiler and the parser.
See also:
- The online playground, wesl.thissma.fr / github.com/wesl-playground
- Nathalie Cuthbert's implementation, mew
- Lee Mighdoll's implementation, wgsl-linker
Contributions are welcome. Please join the discord server and introduce yourself first, or contact via email.