3 ms·
I spent a couple days writing a compiler for a custom shader language. It's a very simple lisp with minimal features, but enough to do everything I use in graph
by peacefulhat 6y ago
I spent a couple days writing a compiler for a custom shader language. It's a very simple lisp with minimal features, but enough to do everything I use in graphics. I compile this into glsl + a struct and functions for cpu side. A lot faster to prototype when I only have to modify my shader, and I can switch out the backend between webgl and opengl. Should be quick to add support for vulkan/metal/dx12 when I need that. I never would have thought to do this solution if I didn't already know how to write compilers. Somebody might say "oh, you could have used ____" - maybe, but it wasn't much effort and I can make it work in a convenient way for me.
(in position f2)
(in uv f2)
(all sprite tex)
(all color f4)
(vert
(position 0.0 1.0))
(frag
(* (sprite uv) color))