What’s this?
Inspired by ShaderToy, I wrote this tool that renders a WGSL shader on a HTML canvas.
We start with a CodeMirror code editor that contains WGSL code. When you press the play button (or when the page loads), we take the source code and run it through naga to compile it to it’s intermediate representation. We could pass the code straight to wgpu, but then we wouldn’t get nice error messages. After successfully compiling the shader, we pass it to wgpu to render it to a HTML canvas. I’m working on a blog post to describe this process in more detail :)