Uses Vello GPU with a native WebGL2 backend in the browser. This example does not use wgpu.
Run with RUSTFLAGS="-Ctarget-feature=+simd128" cargo run_wasm -p native_webgl --release.
If you don't want to enable SIMD, you can remove the RUSTFLAGS="-Ctarget-feature=+simd128" part.
The demo starts compiling Vello‘s shaders before the WebAssembly binary is fetched. The build script writes generated/bootstrap.js, which combines the compileVelloShaders module generated by vello_gpu_shaders with src/bootstrap.js. Because the wasm-bindgen glue imports that snippet before it fetches the binary, the snippet creates the canvas and starts compiling as soon as the page loads the glue. run_interactive then adopts the compiled programs with WebGlRenderer::begin_with_precompiled, falling back to compiling them from scratch with a console warning if they can’t be adopted.
In order to test this crate, you need to have wasm-pack installed. Install it using the steps found in https://wasm-bindgen.github.io/wasm-pack/installer/.
Thereafter, for interactive test sessions, run:
wasm-pack test --chrome # Navigate to printed URL