Repository navigation
Fix #369: restart the web build's graphics after a lost device or context - #403
Merged
Merged
Conversation
bflatastic
force-pushed
the
fix/issue-369
branch
from
October 8, 2026 00:11
6d47e3a to
bda55d3
Compare
…text When the browser dropped the page's WebGPU device or WebGL context, the editor kept running but nothing it drew reached the screen: Chrome and WebKit showed a frozen, stale canvas and Firefox a blank page, while edits and Save went on. - ui-egui: new `graphics` module. `GraphicsLoss` carries a loss report from any thread (wgpu's device-lost callback, the canvas's `webglcontextlost` event) to the UI thread. `VectorcraftApp:: graphics_lost` writes Data Recovery copies of the modified documents at once. The app now notices when the host hands it a new egui context and uploads everything again (fonts and theme, the canvas, place cursor thumbnails); every per-thread texture cache (layer, symbol, swatch, style, asset and glyph thumbnails, previews, font samples, Navigator, Flattener Preview) is a `TexCache` that empties for a new context. Without this, the moved app drew stale or wrong textures and egui panicked on its missing font families. - web: the shell watches both loss signals; on a loss it puts a fresh canvas in place of the dead one and starts the same `WebRunner` again, handing over the same app (documents, undo, panels), with services made for the new context and a status-bar note. If no new graphics can be had (or after three losses) it removes the stale canvas, lets go of the recovery copies and says to reload. - engine: `recovery::leave` lets go of a session's area but keeps its copies, so the reloaded page offers them at once instead of after the heartbeat goes stale. - desktop: eframe can't give a window a new device, so a lost device (driver reset) is logged, the copies are written and the status bar says to save and restart; closing then skips the Save Changes question it can't show. - Tests: loss reporting across threads, `TexCache` emptying, the app uploading the canvas, a cached preview, theme and fonts again in a new context (fails without the fix), copies written on loss, and `recovery::leave` offering copies at once with both lock and heartbeat stores. docs/development.md (web section) and ROADMAP updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bflatastic
force-pushed
the
fix/issue-369
branch
from
October 8, 2026 00:31
bda55d3 to
649656b
Compare
Member
Author
|
Full |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the browser drops the page's WebGPU device or WebGL context, the web build now starts its graphics again with the same documents. Before, it froze on a stale canvas (Chrome, WebKit) or went blank (Firefox) while edits and Save went on.
webglcontextlostevent (WebGL2) report to a newgraphics::GraphicsLoss(ui-egui), whichWebShell::logichandles on the next frame.VectorcraftApp::graphics_lostwrites Data Recovery copies first. Then the shell swaps in a fresh<canvas>and starts the sameWebRunneragain with new graphics, handing over the sameVectorcraftApp(documents, undo, panels). Its services are made for the new context, and the status bar says the graphics were restarted.adopt_context) and uploads everything again: fonts and theme, the canvas, and the place cursor thumbnails. Every per-thread texture cache (thumbnails, previews, font samples, Navigator, Flattener Preview) is now aTexCachethat empties for a new context. Without this, the moved app showed stale or wrong textures, and egui panicked on missing font families.recovery::leave(engine). The reloaded page then offers the copies at once, not after the heartbeat goes stale. The page tells the user to reload.Host, so a graphics restart reuses them and the tab stays the owner of its recovery area.recovery::leavealso drops the area's lock or announcement, so a reloaded page takes the copies at once.docs/development.md(web section, with how to trigger a loss by hand) and the ROADMAP.Checks
72fc1ac0e18dbf241429c87302ba9af71b1df6bc (with #399 Web Locks).cargo fmt --all --check.cargo clippy -D warnings:--all-targets;wasm32-unknown-unknown;aarch64-apple-darwinandx86_64-unknown-linux-gnu;--features windows7on linux.cargo test: ui-egui 625 passed, engine 1296 + integration passed, vectorcraft 18 passed.graphics::tests::*(4) andan_app_that_leaves_has_its_copies_offered_at_once.the_app_uploads_everything_again_in_a_new_contextfails without the fix: wrong canvas texture, and egui panics on the missing fonts.cargo xtask wasm(19/19 ok),cargo xtask layers,cargo xtask brands.loseContext()/device.destroy(). trunk isn't installed on this machine. Please check with?webglplusWEBGL_lose_context, and on WebGPU withdevice.destroy().🤖 Generated with Claude Code