Compilation to WebAssembly bytecode is done via the new WASM backend in LLVM (the Zig compiler sits on top of LLVM).
The whole interfacing with WebGL and WebAudio is actually quite interesting. It's not done through a runtime provided by the compiler SDK (as it is usually done with emscripten), but instead the Zig-to-JS binding is all done "manually" in the project itself.
There are 2 small "shim files" for WebGL/WebAudio and DOM access written in JS here:
Compilation to WebAssembly bytecode is done via the new WASM backend in LLVM (the Zig compiler sits on top of LLVM).
The whole interfacing with WebGL and WebAudio is actually quite interesting. It's not done through a runtime provided by the compiler SDK (as it is usually done with emscripten), but instead the Zig-to-JS binding is all done "manually" in the project itself.
There are 2 small "shim files" for WebGL/WebAudio and DOM access written in JS here:
https://github.com/raulgrell/tetris/blob/master/env.js
and here:
https://github.com/raulgrell/tetris/blob/master/dom.js
...and associated Zig interop files here:
https://github.com/raulgrell/tetris/blob/master/src/webgl.zi...
and here:
https://github.com/raulgrell/tetris/blob/master/src/dom.zig
It's really surprisingly little (and clean) code for doing that sort of thing IMHO.