Facet's materials used to be hand-written WGSL strings concatenated together. It worked, but every material shared boilerplate and every typo surfaced as a runtime pipeline error deep inside WebGPU.

So I wrote a small shader language for exactly one engine. It has structs, functions, a handful of built-ins and nothing else. The compiler is a straightforward lexer, a Pratt parser and a lowering pass that emits WGSL.

Because the language knows about Facet's binding conventions, it can generate the group and binding annotations automatically, catch type mismatches before the GPU ever sees them, and share a standard library of lighting functions across every material.

It replaced a few hundred lines of string manipulation with a compiler I can actually reason about — and it is still small enough to read in one sitting.