A graphics card reset no longer takes the browser down
A fix first. On Windows, a page that ran a WebGPU shader that never ends made Windows reset the graphics card after about five seconds. The page was then handed a buffer of zeros as if its work had finished, and the next page to use WebGPU crashed the whole browser. The browser now notices the reset, tells the page its device was lost, and builds a fresh one for everyone else. Canvas drawing is faster too: shapes made of a few edges (lines, turned sprites) no longer wait on each other on the graphics card, two batches of drawing are in flight at once, and a sprite drawn at whole pixels reads one texel per pixel instead of four. Measured side by side with the current version of the reference browser, the browser is now faster on 6 of our 11 canvas benchmark rows, up from 5, with the same pixels as before.
Surviving a graphics card reset
When a graphics card stops answering, Windows resets it, and every program's work on it is lost. The page's own WebGPU device and the browser's shared one sit on the same card, so the reset removed both, but nothing noticed until a later call failed: the page got zeros back, and the next request for a device was made on a card that no longer existed, which crashed the browser every time we tried it. The browser now asks the card whether it was removed (a cheap question) before handing it out, rebuilds it when it was, and gives the page an honest lost device instead of wrong data.
Canvas shapes without waiting on each other
The graphics card canvas works out how much of each pixel a shape covers. It did that for a whole 16 by 16 tile at once, with the tile's threads adding up each shape's edges together and waiting for each other three times per shape. For shapes with only a few edges in a tile, each pixel now adds up its own row's edges, the same whole numbers in a different order, with no waiting. Round shapes with many edges keep the old way, where it is faster. Two batches of drawing are now in flight at once instead of one, so the card is not idle while the page records the next batch.