git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

scripts/web-probe/compute (885B)

 1 #!/usr/bin/env bash
 2 # web-probe/compute — run the compute probe's jobs (examples/compute_probe/)
 3 # on WebGPU in headless Chromium and print one line each, the format the
 4 # native half prints:
 5 #
 6 #     cargo run --example compute_native > native.txt
 7 #     scripts/web-probe/compute > web.txt && diff native.txt web.txt
 8 #
 9 # Every job's arithmetic is exact in f32, so each line says `exact` and the
10 # digests of the two runs agree to the bit. Needs what `run` needs, but no
11 # fonts.
12 set -euo pipefail
13 here=$(cd "$(dirname "$0")" && pwd)
14 cd "$here/../.."
15 cargo build --release --target wasm32-unknown-unknown --example compute_web >&2
16 site=$(mktemp -d)
17 trap 'rm -rf "$site"' EXIT
18 wasm-bindgen --target web --no-typescript --out-dir "$site" \
19     target/wasm32-unknown-unknown/release/examples/compute_web.wasm
20 cp "$here/compute.html" "$site/compute.html"
21 node "$here/compute.mjs" "$site"