carlok — zsh — 88×30

cat _posts/2026-11-18-contributed-to-zazzati-aurora-a-mobile-first-layout-touch-controls-and-the-gpu-reset-behind-android-s-white-screen.md

Contributed to zazzati/aurora: a mobile-first layout, touch controls, and the GPU reset behind Android's white screen

carlok contributed a mobile-first pass to zazzati/aurora, a Northern Lights simulator that renders the aurora over a WebGL globe, and the pull request was merged on 18 November (#1, 543 lines added and 75 removed, all in index.html). The substantive part is a crash fix: on Android Chrome with a Mali-G720, the WebGL context was lost about four seconds after the first frame, every run, and Chrome then blocked WebGL for the page on reload. Bisecting on the device showed it was not the 3D rendering — the crash happened with every draw call disabled — but makeEarthCanvas(), whose large land-polygon fill Chrome GPU-rasterizes into a 4096×2048 2D canvas; on that GPU the job hangs, the driver resets and every context on the page is lost.

The fix is one option: the 2D context is created with { willReadFrequently: true } so Chrome rasterizes it on the CPU, a one-time cost of about 50 ms for a texture built once. Measured on the same device, the default path lost the context after ~4 s on every run, the CPU-raster path was stable, and so was a variant with the land polygons removed — which is what ruled out the polygons themselves. The 2D source canvas is released after the texture upload (~32 MB), and a webglcontextlost handler now says the graphics context was lost instead of leaving a silent blank page.

The layout work makes the phone the base case rather than a shrunken desktop: the floating panels only come back for screens at least 721×501, phones in landscape get a narrow HUD column and a single slim timeline bar with MORE/LESS revealing the rest, swiping the panel left or the timeline down tucks them off-screen behind a tab and the choice is remembered per browser, and START on a touch device requests full screen and screen.orientation.lock("landscape") with a dismissible rotate hint where those APIs do not exist. Touch gains pinch-zoom around the fingers, two-finger pan, double-tap reset and env(safe-area-inset-*) padding for notches; three previously unstyled toggles share one style keyed on aria-pressed. It was checked on a real Android 10 device, in Chrome’s mobile emulation at 375×812 and 812×375, and at 1440×900 where the desktop layout is unchanged — a real iPhone was not covered, and full screen and orientation lock are unavailable there by design.