#wgsl #syntax-tree #shader #source #language #parse #extension

app wgsl-tools

Various tools to parse, verify, evaluate and modify wgsl shader source

2 releases

0.0.2 Aug 20, 2024
0.0.1 Aug 19, 2024

#217 in Game dev

40 downloads per month

MIT license

195KB
4.5K SLoC

Rust 2.5K SLoC // 0.1% comments LALRPOP 1.5K SLoC // 0.1% comments WebGPU Shader Language 525 SLoC // 0.1% comments

WGSL Tools

A work in progress!

This project will implement the necessary tools to build complex shaders, like 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.

This will be the home of a few wgsl source manipulation tools:

  • A syntax tree, allows representing wgsl source.
  • A parser, converts source to the syntax tree and provides human-readable error messages.
  • (TODO) A checker, verify that a wgsl code is correct.
  • (TODO) Various implementations of wgsl language extensions, the first ones will be imports and generics.

Goals

  • Correct, mirror concepts present in the wgsl spec.
  • Flexible, allow extending the wgsl syntax with well-defined extensions (see wgsl-tooling-wg).
  • User-friendly, by sticking to the spec as much as possible, by providing clear and well-documented interfaces.

Non-goals

  • Performant, we care about correctness, less so about time and memory constraints. The interface must be as user-friendly as possible. These tools target offline compilation first.

Dependencies

~6–8.5MB
~111K SLoC