The renderer moved to Rust
In v2026.11.13, Rust recorded every GPU pass in the same WebAssembly module as the physics. How that renderer worked and how it performed at 1080p and 4K.
Update, November 24, 2026. Pinionfall now submits frames directly to WebGPU from TypeScript. See the v2026.11.24 release notes and gameplay measurements.
Until this release, Pinionfall’s renderer was TypeScript: a large frame orchestrator and a few hundred passes, each encoding its own WebGPU commands. In v2026.11.13 every one of those passes is recorded in Rust instead, through wgpu compiled to WebAssembly, in the same module that already held the Rapier and parry physics. TypeScript still runs the game. This post is about why, how it works, and what it changed, measured.
Why Rust
The honest reason is control and cost on the CPU side. A frame of this engine is a lot of small bookkeeping before any GPU work happens: draw lists for every shadow cascade, bind groups keyed by the resources they name, upload ranges, the streams of terrain, trees, rocks, structures and characters. In TypeScript each of those is an object, and each crossing into the browser’s WebGPU implementation is a call with its own validation. In Rust the same records are plain data in WASM memory, checked once, and they cross into JavaScript once a frame instead of once a record.
What Rust does not change is the GPU work itself. wgpu’s web backend issues the browser’s own WebGPU calls, so a pass that waits on the graphics card costs exactly what it cost before. Where the frame is the GPU’s (4K, the sea filling the screen), Rust can only reach parity on that pass; the gains there came from the passes themselves, many of them reworked in the same campaign.
How a frame is recorded now
TypeScript decides, Rust records. Each frame the game still culls, sorts, picks levels of detail and fills the uniform blocks in TypeScript. Then, pass by pass, it hands Rust words instead of objects:
- Described groups. A pass whose bind groups carry dozens of entries (the water colour pass binds about fifty resources from a dozen owners) is not mirrored in Rust entry by entry. TypeScript hands its layouts over once, as words, and at every encode each group as the handles, offsets and views it was made from. Rust checks every group against its layout and keeps one bind group per distinct set of resources.
- Recorded streams. Draws whose order and culls are logic (the skinned shadow casters, the structures’ pieces) run against a recording pass that turns every call into words. Rust checks the whole recording, the way WebGPU would, and replays it with its own pipelines. A stream that did not change is replayed from a bundle Rust keeps, without its words being sent again: at a market, about ten thousand command words a frame no longer cross the boundary.
- Lent buffers. wgpu cannot adopt a buffer JavaScript made, so a buffer a Rust pass binds is made by Rust and lent back as the browser’s own object.
- One command buffer. With no TypeScript command left in a settled frame, the whole frame is one Rust command buffer and one submit, held and submitted at the top of the next animation frame so the GPU runs frame N while the CPU builds frame N + 1.
The shaders moved too. The engine’s WGSL lives in one tree in the core, read by Rust with include_str! and by the game
through a generated module, spliced by the same rules on both sides, so a file is the one text of its shader.
Pipelines that never hold a frame
The first version of the port froze the loading screen for up to twenty seconds. wgpu 30 created every pipeline synchronously, and Chrome compiles shaders on the GPU process thread that also presents every frame, so nothing reached the screen until the compile was done. We vendored wgpu with its asynchronous pipeline creation backported: every Rust pipeline is now created asynchronously and polled, a pass whose pipeline is still compiling answers “pending” and is simply not drawn that frame, and the reveal after the loading screen waits until nothing is compiling. A small gate keeps only a few compiles and shader modules in flight at once, so the compiles never starve the browser’s own drawing.
What it means for a licensee
If you extend the engine, most of your work is still TypeScript: game logic, culls, a new material’s choices. A new GPU
pass is described rather than encoded: a compute pass hands its WGSL text, entry point and layouts to the engine’s
program registry once, then a plan of groups and dispatches each frame, and needs no new Rust export. The engine counts
any TypeScript GPU command that reaches a frame and names it under ?diag, because one would split the frame’s command
buffer. Changing the Rust side itself (a pass’s recording, the physics, a shader) means the physics workspace and one
build command that installs the module back into your checkout; ARCHITECTURE.md describes the layout and the gates.
The numbers
Measured against v2026.11.04, the TypeScript renderer, on the same machine: headless Chrome, uncapped, the same fixed places on both builds, two runs of each alternated, warm caches, saves reset. Frame times in milliseconds (lower is better), the mean and the 95th percentile.
| 1920x1080 High | Rust | TypeScript |
|---|---|---|
| a town market | 22.4 (24.6) | 23.3 (30.6) |
| a cliff | 19.9 (35.8) | 28.5 (63.0) |
| a ridge | 21.8 (40.1) | 33.2 (67.7) |
| a grove | 15.4 (30.8) | 23.8 (36.8) |
| out to sea | 26.3 (46.5) | 37.0 (72.4) |
| 1,500 m up | 10.5 (17.3) | 13.8 (24.2) |
| on the moon | 5.8 (8.6) | 11.7 (21.1) |
At 3840x2160 the Rust build’s mean is lower at every place we measured (the market 35.8 against 46.3, out to sea 66.1 against 86.8), and it reaches the playable world sooner (38 against 55 seconds in these runs).
Not every row improved. At 1080p a town market at night has more frames over 33 ms on the Rust build, because it is fast enough there to be limited by the graphics card and Chrome then alternates short and long frames; its mean is still a quarter lower. A fast low flight is about 1.5 ms slower at 1080p, which a first comparison puts on the new lighting and vegetation rather than on the renderer. The Low preset is slower at most places: it is limited by the CPU on most machines, and it is next on the list.
Most of the frame time above came off in the passes themselves (shadows, clouds, water, the material resolve), work the move to Rust made easier to see and change. The language alone does not make a GPU faster; owning every command of the frame made it possible to stop paying for the ones that were not needed.