perf(scene): stop re-tessellating on preview/interim overlay updates

Phase 2.2 (partial). set_preview_wires / clear_preview_wire /
set_interim_wire called bump_geometry, so every rubber-band frame of a
drawing command invalidated the wire cache and re-tessellated the whole
model — the same 30ms->400ms spike as selection, but while drawing.

Preview / interim wires are an overlay appended to the cached base wire
set in build_primitive; they are not part of the tessellation cache, so
they no longer bump geometry. The base model-tile tessellation stays a
cache hit (static camera, no geometry bump), and the overlay still forces
a GPU wire re-upload through the has_overlay content-id path. Real commits
(commit_entity / transform / copy) bump geometry on their own, so finished
edits and preview-clear still render correctly. Snap/hit-test via
entity_wires_arc also stops re-tessellating per preview frame.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-05 10:21:32 +03:00
1 parent db8c5dc43f
commit ccb9bb832d
2 files changed
+21 -3

No files matched your search

+10
View File
@@ -132,6 +132,16 @@ handles; the render path re-tessellates only those, reusing the rest.
Also useful on open: any partial cache (e.g. from block defns) can be
re-used.
**Partial (landed): preview / interim overlays.** `set_preview_wires`,
`clear_preview_wire` and `set_interim_wire` used to `bump_geometry`, so every
rubber-band frame of a drawing command re-tessellated the whole model (the
same 30 ms → 400 ms spike, but while drawing). Preview / interim wires are an
overlay appended to the cached base wire set in `build_primitive`, not part of
the tessellation cache — so they no longer bump geometry. The base stays a
cache hit (no re-tess), and the overlay forces only a GPU wire re-upload via
the `has_overlay` content-id path. Snap/hit-test (`entity_wires_arc`) also
stops re-tessellating per preview frame.
### 2.3 Progressive first render
On the first frame emit a **coarse**-tol wire pass (e.g. 4× the normal
+11 -3
View File
@@ -4251,14 +4251,21 @@ impl Scene {
// ── Preview wire ──────────────────────────────────────────────────────
pub fn set_preview_wires(&mut self, wires: Vec<WireModel>) {
// Preview wires are an overlay appended to the cached base wire set in
// `build_primitive`; they are NOT part of the tessellation cache. So a
// preview update must NOT bump `geometry_epoch` — that would re-
// tessellate the whole model on every rubber-band frame. The overlay
// forces a GPU wire re-upload on its own (the `has_overlay` content-id
// path), and iced redraws after the message that set the preview.
self.preview_wires = wires;
self.bump_geometry();
}
pub fn clear_preview_wire(&mut self) {
// No geometry bump — see `set_preview_wires`. Dropping the overlay
// flips the wire content id back to the base tessellation id, which
// re-uploads the base wires (without the preview) on the next frame.
self.preview_wires = vec![];
self.interim_wire = None;
self.bump_geometry();
}
pub fn wire_models_for(&self, handles: &[acadrust::Handle]) -> Vec<WireModel> {
@@ -4284,8 +4291,9 @@ impl Scene {
}
pub fn set_interim_wire(&mut self, w: WireModel) {
// Overlay wire — same reasoning as `set_preview_wires`: no geometry
// bump, so the model isn't re-tessellated on every interim update.
self.interim_wire = Some(w);
self.bump_geometry();
}
// ── Selection ─────────────────────────────────────────────────────────