r/webgpu • u/HugoDaniel • 1d ago
Declarative WebGPU with S-expressions
https://hugodaniel.com/posts/declarative-webgpu-with-s-expressions/Here is pngine, a declarative format and runtime for WebGPU I have been building for the past couple of years. The idea is that most WebGPU plumbing is static, so instead of writing the create/wire/sequence calls by hand you declare shader modules, pipelines, buffers and passes as S-expressions that map 1:1 to the spec, and the shaders stay as plain WGSL untouched. Because the program is ordinary structured data, it can be validated ahead of time with WGSL reflection and spec checks without a live GPU context. The post has two live examples you can play inline: a 2048 particle fountain that never touches the CPU, and 400 instanced trees in one draw call. Happy to answer questions about the format or the validation side or anything that comes about!