garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/retired/egui-quiet-frame-staleness.md

raw


topic: retired/egui-quiet-frame-staleness triggers: ["egui_manager.rs", "end_egui_frame", "WorldAnchored", "keep_egui_fresh", "repaint_delay", "stale UI", "frozen HUD", "quiet frame"] updated: 2026-11-26

Retired: egui's quiet-frame skip

Retired 2026-11-26, when egui left the client: the component library redraws every frame, so nothing skips a frame's geometry on its own say-so any more. The lesson to keep if a redraw skip ever comes back: a UI's own "nothing changed" knows only its own input — content read off the world (a clock, the camera, a projected pin) goes stale under it silently, and worst in a scripted capture, which exists to settle. What follows is the note as it stood.

egui's repaint signal does not know about the ECS

egui_manager::end_egui_frame skips the tessellate → clone → upload chain when egui reports repaint_delay == Duration::MAX, and lets egui_pass redraw the last-written primitives against the fresh colour target. That skip is worth keeping — without it a completely static menu bar reallocated and re-uploaded its whole geometry sixty times a second — but it rests on a premise that is only sometimes true:

egui says nothing changed, therefore this frame's shapes equal last frame's.

repaint_delay answers a narrower question than that. It means "no input reached me, no animation is running and nobody called request_repaint". It says nothing about a shape list built from Res<GlobeState>, a Transform, a clock, or a streaming tile count — because egui has never heard of any of them. So an overlay whose content comes from the world can go on painting an arbitrarily old frame while the world moves under it, and nothing anywhere logs a thing: the geometry is valid, the render pass succeeds, the picture is simply from before.

How it was found (2026-08-15)

A --shot-mode earth capture from 14,000 km carried a scale bar reading "200 m". 200 m is the bar for an altitude near 1.5 km; hud::render_map_controls suppresses the bar entirely above GLOBE_SHOW_ALT, and a probe confirmed it had correctly drawn nothing for the whole 20-second settle. The geometry in the PNG was from frame 2 of the run, where the camera was still at 1478 m on its way out — the last frame before egui went quiet. Disabling the skip removed the bar; that is the A/B.

The failure needs a run that stops changing, which is precisely what --settle is for. It is therefore worst exactly where it is least visible: a scripted capture, whose whole purpose is a picture nobody watched being taken.

What is fixed, and what is not

Scripted captures no longer meet it (2026-11-26). shot_harness::keep_egui_fresh set force_next_write every frame for the lifetime of a ShotHarness, so a shot run never took the skip; it went when the last screen egui drew in a native capture moved to the component library. What egui still draws — the on-screen keyboard's egui half and the web build's cosmos sky — is in no native capture. Put it back (in egui_manager, gated on shot_in_progress) the day egui draws anything a --shot photographs again: without it that capture is a picture of an unknown earlier frame.

The live app still has the property, and it is not obviously fixable for free. Anything read off the world and drawn into the overlay can freeze on a quiet frame — the HUD clock, the coordinate readout, the altitude, the compass needle while the camera glides or a movement key is held (a held key produces no repeated winit events, so egui sees no input at all). Three options; the second is taken for the map overlays (below):

The map pins (2026-10-17)

The first complaint: "when moving around, the pins are not kept in place on all rendered frames." Walking with a finger held still on the stick, the follow camera catching up and a GPS glide are all frames with no events, so the pins stood still on them and jumped on the next frame that carried a touch.

The targeted option is taken for the world-anchored overlays: place_pins (saved places, chat points, posts, people), chat_overlay::render_chat_bubbles and locate::render_locate_arrow record every screen position they paint in an egui_manager::WorldAnchored, which requests a repaint on the frames one moved, appeared or went, and on no others. A still map with pins on it keeps the skip. A new overlay painted at a projected world point needs one too; the POI card (data_layers::render_poi_popup) and the gizmo still have none. animating() is not a substitute: a quarter-second redraw is a stutter against a map drawn at sixty. The HUD readouts listed above are still open.

Since 2026-11-26 no egui overlay is world-anchored: the pins, the chat bubbles, the device arrow, the plans, the names and a lens's marks are the component library's, which redraws every frame, so WorldAnchored was deleted with its last caller. What took egui's place for a scenario is the idle throttle: a playing clock over a still map keeps full frames through ScenarioView::animating in frame_pacing::present_rate.