Skip to content

fix(paint): allow paint keep to copy unchanged LiveText nodes across frames - #2094

Merged
Hona merged 1 commit into
devfrom
fix/2084-live-text-paint-keep
Nov 25, 2026
Merged

Hona merged 1 commit into
devfrom
fix/2084-live-text-paint-keep

Conversation

@Hona

@Hona Hona commented Nov 25, 2026

Copy link
Copy Markdown
Member

Refs #2084

Root cause

  • static_ok in crates/rune/src/runtime/paint/keep.rs required t.cold.live.is_none(), marking every LiveText node permanently unfit for PaintKeep. Whenever another element animated (such as a spinner or 3D view), every unchanged LiveText re-emitted its glyphs every frame.

What changed

  • crates/rune/src/runtime/paint/keep.rs: removed t.cold.live.is_none() from static_ok so unchanged LiveText nodes can be copied across frames.
  • crates/rune/src/runtime/motion/live_latch.rs: bumped node.epoch = crate::runtime::paint_keep::next_epoch() whenever latch_live replaces a LiveText node's content, invalidating its PaintKeep record so updated nodes repaint on that same frame.
  • crates/rune/src/runtime/paint/keep_tests.rs: added regression test covering unchanged copy, single-cell update, wrapped/truncated/line-clamped/rounded-clip updates, debug keep_check parity, fresh-paint byte equality, and accessibility tree updates.
  • changelog/unreleased/2026-11-25-live-text-paint-keep.md: changelog entry.

Headless --profile perf measurement (500 LiveText cells, 5 paired alternating runs, 240 frames)

Headless Runtime CPU only (excludes GPU upload and presentation).

Between-tick frame Before After
Nodes copied (RUNE_PAINT_KEEP_LOG=1) 500 / 1,537 (501 unfit) 1,526 / 1,537 (1 unfit)
Paint CPU p50 (median of 5 pairs) 0.731 ms 0.072 ms
Frame CPU p50 (median of 5 pairs) 0.768 ms 0.097 ms

Verification

  • Debug tests with PaintKeep::keep_check active: cargo test -p rune --lib -- live_text runtime::paint (36 passed, including live_text_copied_between_changes_and_repainted_on_update).
  • cargo clippy -p rune --lib --bins --tests: 0 errors.
  • scripts/file-size.sh: 0 errors.
  • macOS arm64 (cargo test -p rune --lib runtime::paint::keep) and Linux aarch64 (cargo check -p rune -p rune-kit --tests): passed.
  • Not checked on this machine: interactive window / GPU presentation (headless runtime only).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant