A compiled app runs on the browser’s GPU

The web build compiles Rust to wasm32-unknown-unknown and renders with WebGPU. The same code that opens a native window draws into a canvas. The component runner and racer use the same hosted application build.

Use HTTPS or localhost. The browser must expose WebGPU and provide a suitable graphics adapter and device. A browser version alone does not establish that: operating system, GPU, driver and browser settings also matter. The framework reports setup failures, and there is no WebGL fallback.

The site’s automated browser checks use Chromium on Linux with SwiftShader, a software GPU implementation. They exercise startup, input and layout; they do not measure hardware performance or certify Safari, Firefox, Android or iOS configurations. Test the app on the devices you intend to support.

The demos page

The framework’s web package, vapors-web-demo, picks what it shows from the query string:

AddressShows
No queryAn index of the demos, drawn by vapors
?demo=hello, counter, boxes, shell, panel, text, stress, toasts, scroll, images, cards, slider, checkbox, number, fieldThat component demo
?demo=imageThe image viewer
?demo=one-sceneThree cubes in a 3D scene styled by the component’s CSS, under HTML buttons
?demo=racerThe top-down racer: a 3D world drawn by the scene renderer, under a component HUD

Adding &samples=1 or &samples=4 draws a component demo, the one-scene example or the racer at that many samples per pixel and shows its GPU time in the bar at the top of the page; the image viewer refuses it. The page shows a bar at the top with the demo’s name and links to the demos before and after it; &bar=0 leaves the bar out, as the frames on this site do. An unknown name is reported in the page’s error element with the list of demos. The examples page describes each demo and shows its source.

Use the image viewer

Launch the image viewer and try these controls:

ActionControl
ZoomScroll or pinch
PanDrag or use one finger
Fit / actual sizeDouble tap
FitPress 0
Actual sizePress 1
Open an imageUse Open, or press o

The Open button supplies the user gesture the file picker needs on touch devices. Keep that button available when embedding the image viewer. An application that draws its own Open control calls vapors_platform::app_draws_open() before it runs, which hides the page’s button; hide_status_line() hides the status paragraph. The component demos do both.

Build it locally

From a source checkout with the repository’s tools installed:

cargo xtask web

This uses Trunk to build the web package into target/web, with a relative public URL, so the page can be served at / or under a path. cargo xtask dev rebuilds it on each save and serves the debug build. The cargo xtask wasm step is a lint for the wasm target; it does not serve the page.

The page contract

The platform expects a canvas with ID vapors. Its CSS determines the display size; the platform reports physical pixel dimensions to the renderer. Set touch-action: none on the canvas so browser scrolling does not consume its gestures.

The page can provide a status paragraph, an error paragraph and an #adapter element, which the platform fills with the name of the GPU adapter it got. Errors are shown separately from ordinary status lines. The image viewer needs the Open button; the component demos do not. The framework web guide gives the element IDs and required styling.

If a page does not start

Read its visible error first. A missing WebGPU API, failed adapter or device setup, an invalid page contract and a component the element tree refuses are distinct errors, each reported in the error element. Source guides remain readable when a device cannot run the graphical preview.

This site hosts one build of the web package, made on 18 November 2026 at the framework revision these articles describe. The home page uses it for the racer, the examples page for components and the image viewer, and HTML, SVG and 3D in one frame for the one-scene example. Direct launches use /demo/?demo=<name>. static/demo/provenance.json records the commit and the SHA-256 of each file.