Files
metal2vulkan/docs
Anees Iqbal b6c025c12b Free a moved shadow's image once the command buffer that took the move completed
A texture over host pages made before its in-place verdict is a shadow, and moves in place at a
commit once its class's verdicts pass (`texture/storage_form.rs`). The shadow's image then stayed
with the texture until it went, so a long-lived surface kept an unused texel-sized image and its
merges' scratch buffers for the session.

The switch's last part now writes the shadow's image (a tracked transfer write of every level and
layer), so hazard tracking orders the committing command buffer after every use of the shadow
committed before it, on any queue, and that command buffer holds a ShadowAfterMove. Once it
completed, where the texture moved in and only the texture's storage and this hold the shadow's
image, the image's VkImage, views and memory go (`Image::let_go_unused`, the release a drop runs,
at most once), and its merges' kept scratch buffers. Nothing names the shadow by then: every later
command presents the image in place. A view of the texture made before the move, a shadow made
over the shadow's image (which holds it as its truth, `shadow::ImageTruth`), and an untracked
texture keep it until those and the texture go. The in-place counts are unchanged.

New WorkCounts field: host_texture_shadows_freed_after_move. FAST-PATHS (the in-place row) and
HOWTO say when the shadow goes.

Verified:
- runtime_lane::in_place_textures::a_texture_made_before_its_verdict_moves_in_place_once_it_passes
  now requires as many shadows freed as moved (polled up to its wait): "moved 1, in place 1,
  shadows freed 1" on lavapipe (gem10 m3-max-7070, at this base; msi m3-max-7019 at fa17b6ada4)
  and on the M3 Max (m3-max-7027 at fa17b6ada4; the patch is the same at this base).
- Touched runtime tests (in_place, storage_form, shadow, fetch, self_read, usage and view
  shadows, heap_set_copies): 73/73 on lavapipe (m3-max-7070); 71/71 on the M3 (m3-max-7027);
  the in-place lane 7/7 on both.
- Negative control a68e9f2e91 (ShadowAfterMove does nothing) on lavapipe (m3-max-6973): the lane
  test fails, "after the move: 0 shadow images freed, where 1 moved".
- clippy -D warnings for the runtime and validation crates, plain, --cfg m2v_cpu_icd and
  --cfg m2v_gpu (msi m3-max-7019); signatures blessed; refusal surface unchanged.

(cherry picked from commit ea33a4ce5c909723a5c425a7e1dd8ce0fc4a8d5f)
2026-11-07 21:41:11 -08:00
..