Files
gex/web/test/gpu-compositor.html
bomberfishandClaude Opus 5.5 958243238a /dev/gex-gpu served by the compositor, on its own device
The wire's server can give every client the host's adapter and device
(gexgpu_server_set_shared; requests answered at once, and a client
cannot destroy the device), and the page's build imports a JS
GPUAdapter and GPUDevice for it. The compositor's worker hosts the
server on its device (Compositor.hostGpu), so a guest's textures are on
the device that draws the screen, which presenting a guest's frames
without a copy needs; a page with no compositor serves it itself.

web/test/gpu-compositor.html runs gpu-smoke against the compositor's
server: "gpu-smoke: ok" in Chrome.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_f0a06c8a084b4b2ca4f7f291183d507d
2026-10-14 08:21:34 -04:00

23 lines
1.0 KiB
HTML

<!doctype html>
<meta charset="utf-8">
<title>WebGPU in the compositor</title>
<canvas id="c" width="320" height="240"></canvas>
<pre id="out"></pre>
<script type="module">
// /dev/gex-gpu served by the compositor's worker on its own device
// (Compositor.hostGpu), with a guest (guest/gpu/test/gpu-smoke.c, from
// web/public/gex/test/) running in a Worker of its own.
import { Compositor } from '../src/compositor.js';
import { makeWlChannel } from '@gex/wl-bridge.mjs';
import { makeGpuChannel } from '@gex/gpu-bridge.mjs';
const out = (s) => { document.getElementById('out').textContent += s; };
const comp = await Compositor.create(document.getElementById('c'), makeWlChannel());
const channel = makeGpuChannel();
await comp.hostGpu(channel, new URL('/gex/gexgpu-server.mjs', location.href).href);
out('served by the compositor\n');
const w = new Worker(new URL('./gpu-worker.mjs', import.meta.url), { type: 'module' });
w.onmessage = (e) => { out(e.data); if (e.data.startsWith('exit')) window.done = e.data; };
w.postMessage(channel);
</script>