Files
metal2vulkan/crates/metal2vulkan-runtime/examples
Anees Iqbal 4a4271088c RUNTIME 2515: carried kept draws not drawn before a split are re-homed past it
A render encoder that opened from a carry holds kept draws of the states its command buffer's
earlier encoders drew. At a split of its pass instance, rehome_aside re-homed the kept draws set
aside in the encoder but let go of every carried one not drawn since, and select_kept's opened
check dropped the rest once the instance changed. Each such state's first draw after the split
then took every step. On the Iris walk of a guest animation page (ia-p150), a fit over its
per-second counts puts 12 to 20 of the 46.6 full draws a present in encoders that opened from a
carry at splits (~3.6 splits a present, 3 to 5 carried states undrawn at each), at an estimated
88-101 us a full draw against ~10 us a rebound one.

- rehome_aside re-homes a carried kept draw like the others (readers and draws that read the
  pass's colors are still let go); it stays carried.
- draw_rebound begins nothing for a re-homed draw (the split's draw began the instance it
  records into); select_kept lets a re-homed carried draw past the opened check.
- Kept::carried_into clears the mark, so the next encoder's first draw of it still begins that
  encoder's first instance.

Why the re-homed draw is right in the new instance: it stays carried, so its rebind brings every
slot the encoder's calls bound since its opening, and carried_stale stops it where the bind
state holds a slot no call of the encoder bound (a new encoder inherits no binding in Metal).
Its state commands record against the instance it records into (settled none, a fresh record;
inline_splits.rs: the record stays valid across instances in one primary command buffer). Its
uses are made whole and gathered into the instance after the split, so the barrier and copies
the pass end plans before that instance order it as an every-step draw there.

WorkCounts: kept_draws_rehomed_carried (of kept_draws_rehomed) and kept_draws_carried_unopened
(carried draws still let go at select because the instance is no longer the opened one). No new
Degradation kind. draw_costs gains a "splits" shape.

Tests: split_keeps::carried_draws_undrawn_at_a_split_are_rebound_past_it (commands, state
commands and pixels equal the every-step run; debug builds compare the carried draws field by
field). Verified (rebound lane): msi lavapipe m2v_cpu_icd 86/86 of the split, carry, rebound and
recovery-carry suites (m3-max-39124); negative control with the carried reject back fails the new
test (m3-max-39129); release build of the example (m3-max-39128). Clippy x3, rustdoc and the
splits bench run on development after.
2026-11-16 21:28:58 -08:00
..