WasmGPU - v0.1.0
    Preparing search index...

    WasmGPU - v0.1.0

    W a s m G P U   =   W e b A s s e m b l y   ⨯   W e b G P U


    • ✅ WebGPU core working (renders a rotating cube)
    • ✅ AssemblyScript → Wasm math module wired into TS
    • ✅ Builds for both ESM and IIFE consumers
    • 🛠️ API still evolving so expect breaking changes!

    The dist/ folder contains:

    • WasmGPU.js / WasmGPU.min.jsESM bundle
    • WasmGPU.iife.min.jsIIFE bundle (global WasmGPU)
    • math.js — AssemblyScript ESM bindings (loads wasm)
    • math.wasm — WebAssembly module

    Important: math.js and math.wasm must be hosted next to the WasmGPU bundle (same dist/ directory).

    <canvas></canvas>
    <script type="module">
    import { WasmGPU } from "@zushah/wasmgpu";

    const canvas = document.querySelector("canvas");
    const wgpu = await WasmGPU.create(canvas);
    wgpu.setClearColor(255, 255, 255);

    function frame(t) {
    wgpu.renderFrame(t * 0.001);
    requestAnimationFrame(frame);
    }
    requestAnimationFrame(frame);
    </script>
    <canvas></canvas>
    <script src="https://cdn.jsdelivr.net/gh/Zushah/WasmGPU@0.1.0/dist/WasmGPU.iife.min.js"></script>
    <script>
    const canvas = document.querySelector("canvas");

    WasmGPU.create(canvas).then(wgpu => {
    wgpu.setClearColor(255, 255, 255);

    function frame(t) {
    wgpu.renderFrame(t * 0.001);
    requestAnimationFrame(frame);
    }
    requestAnimationFrame(frame);
    });
    </script>
    1. Install dependencies: npm install
    2. Build: npm run build
    3. Serve locally: npm run start or use the live server extension

    Quick examples: examples/esm.html and examples/iife.html.

    WasmGPU is available under the Mozilla Public License 2.0 (MPL-2.0).