perf(layers): toggle layer visibility without re-tessellating

Turning a 141k-entity layer off/on took 1.5-5 s; it now takes ~0.6-0.9 s.

- Off/freeze toggles go through invalidate_layer_visibility: entities on
  the layer keep their tessellation memo (visibility gates them before
  tessellation); only block users re-expand. No mesh recolor.
- The resident patch reuses a surviving memo entry instead of
  re-tessellating, guarded by the same display-context hash as the full
  build.
- The patch looked up `layout.order` linearly per re-shown entity, which
  made turning a big layer back on quadratic.
- recolor_meshes_for_handles resolved materials for handles with no mesh.
- Wire arena: a hidden slab keeps its instances and sets a `hidden` flag
  in its consts (collapsed in the vertex shader); an unchanged re-show only
  clears the flag. Const writes are batched into merged spans.
- The `layer_visible` automation action indexed the document's layer
  table instead of the sortable panel rows the Layer* messages use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-05 15:53:27 +03:00
1 parent c35b902f3a
commit de6e27304d
7 files changed
+228 -64

No files matched your search

+4 -2
View File
@@ -118,7 +118,9 @@ pub struct WireConst {
/// in drawing units.
pub world_half_width: f32,
pub is_tapered: f32,
pub _pad2: f32,
/// Non-zero hides every segment of the wire: arena slabs of hidden
/// entities stay resident and are collapsed by the vertex shader.
pub hidden: f32,
/// Point-marker origin as a double-single pair. `marker_normal_scale.w`
/// stores the viewport-height percentage; zero disables marker scaling.
pub marker_origin_high: [f32; 4],
@@ -776,7 +778,7 @@ pub(crate) fn emit_wire_native(
align_total,
world_half_width: wire.world_width * 0.5,
is_tapered: if is_tapered { 1.0 } else { 0.0 },
_pad2: 0.0,
hidden: 0.0,
marker_origin_high,
marker_origin_low,
marker_normal_scale,