Documentation

WebAssembly

The unchanged CPU renderer compiled to wasm32. Plain numbers in and out, no bindings generator, no imports, and the same bytes as the native build.

A text field with a focus ring and a caret, drawn by AsterDrawn by Aster

Aster's CPU renderer compiles unchanged to wasm32-unknown-unknown. The module has no imports, no generated JavaScript glue and no threads (stage 1: single-threaded). A page reads the RGBA8 framebuffer straight out of the module's linear memory.

Status: pre-1.0. The aw_* exports below are the current build's ABI; signatures are not frozen. The built-in workloads are the scripted scenes used for qualification. The general application API for the browser is not part of this stage.

Licence: the SDK and examples are MIT; the runtime ships under the Aster Runtime EULA. Use the prebuilt .wasm modules. Every command below was run from a source checkout (web/), and the evidence paths refer to it.

What was measured, and how

Two variants are built, both wasm32-unknown-unknown: scalar (baseline wasm, runs on every engine) and simd128 (-C target-feature=+simd128).

scalarsimd128
raw size9,916,065 bytes9,911,815 bytes
gzip -94,050,278 bytes4,052,219 bytes
brotli (quality 11)2,608,349 bytes2,602,996 bytes

(Built 2026-11-15 from main f19b91bcd with rustc 1.98.0, web/tools/build-wasm.sh, no wasm-opt pass. Brotli and gzip measured with Node 22 zlib.)

Byte-exactness. The native renderer is the oracle. For every frame of eight scripted workloads (static, hover, type, scroll, fluid, theme-fade, charts, cinematic) at 1920x1080@1x and 960x540@2x, 61 frames each (the initial picture plus 60 steps of 16 ms), the FNV-1a-64 hash of the wasm frame was compared with the native frame hash:

Output
ok   charts/1080p-1x        61/61 frames equal
...
{"wasm":"aster_web.scalar.wasm","series":16,"failed_series":0,"frames":976,"equal_frames":976}
{"wasm":"aster_web.simd128.wasm","series":16,"failed_series":0,"frames":976,"equal_frames":976}

A stronger spot check: the charts workload's first frame at 1920x1080 as raw RGBA8, hashed with SHA-256, is identical on native, wasm scalar and wasm simd128:

Output
8023bc0c2edeae2ae2caed319597950086867099b61ed53b5207a6d3abb1f6b4

Method: web/tools/check-wasm-exact.mjs (Node, V8, no browser) against aster-web-oracle output; the full suite in web/README.md also covers 4K sizes and a wasm-opt variant. This run used 1080p-1x and 1080p-2x only.

Build

Requires Rust 1.98 with the wasm32-unknown-unknown target (rustup target add wasm32-unknown-unknown) and Node 22 (any Node 20.15+ works; the snippet uses zlib.crc32).

Shell
cd web
tools/build-wasm.sh scalar  out/     # out/aster_web.scalar.wasm
tools/build-wasm.sh simd128 out/     # out/aster_web.simd128.wasm

Render a frame (Node, no browser)

snippets/wasm/render.mjs is a complete program: instantiate, init a workload, step once, read the framebuffer, write a PNG.

Shell
node snippets/wasm/render.mjs out/aster_web.simd128.wasm 6 1920 1080 1000 charts.png
# 1920x1080 sha256(rgba)=8023bc0c2edeae2ae2caed319597950086867099b61ed53b5207a6d3abb1f6b4
# aw_hash (fnv1a-64)=da92d77a68616aa6

Arguments: workload id, logical width, logical height, device scale x 1000, output file. The core of it:

JavaScript
const { instance } = await WebAssembly.instantiate(readFileSync("aster_web.simd128.wasm"), {}); // no imports
const x = instance.exports;
x.aw_init(6 /* charts */, 1920, 1080, 1000);   // returns < 0 on failure; message at aw_err_ptr()/aw_err_len()
x.aw_step();                                   // one scripted 16 ms frame: 1 new picture, 0 unchanged
const rgba = new Uint8Array(x.memory.buffer, x.aw_frame_ptr(), x.aw_frame_len()); // straight-alpha RGBA8, top-left

The aw_* exports

All exports are plain numbers in, numbers out. One instance holds one app.

exportpurpose
aw_init(id, w, h, scale_milli)build workload id at a logical size and scale/1000
aw_step()advance one scripted 16 ms frame
aw_advance(ms)move the app clock; aw_needs_frame(), aw_next_deadline() say when to draw next
aw_frame_ptr/len/width/heightthe RGBA8 framebuffer in linear memory
aw_hash()FNV-1a-64 of the current frame (cheap enough for every frame)
aw_app_damage(), aw_damage_ptr()changed device rectangles [x, y, w, h] since the last call
aw_move/down/up/leave/wheel/key/textpointer, wheel, key and text input
aw_resize, aw_theme(code, fade_ms)resize; switch theme with an optional cross-fade
aw_semantics(), aw_sem_ptr()the accessibility tree as JSON
aw_alloc/aw_free, aw_err_ptr/aw_err_lenstring passing and error messages

Source of record: web/aster-web/src/abi.rs.

Animation

snippets/wasm/frames.mjs dumps consecutive frames; the gallery animations on this site (theme-fade and fluid) were made with it, 36 frames at 960x540, 60 ms per frame.

Shell
node snippets/wasm/frames.mjs out/aster_web.simd128.wasm 5 960 540 1000 36 frames.rgba

Performance (what we measured, with its caveats)

See benchmarks.json for the numbers with machine and date. They were taken on a shared, heavily loaded 96-core host (load average above 100) and are single-run medians; treat them as an upper bound, not as a tuned result.