Files
metal2vulkan/crates
Anees Iqbal 3928b662ca Keep a shadow's standing across command buffers where only the runtime's commands write its truth
A texture over a tracked Private buffer the runtime made (an IOSurface plane's
device copy among them) copied its truth in again at every command buffer's
first use, as if the CPU could have written it since the last commit. Only the
runtime's commands write such a buffer, so whether the image still holds the
truth is known exactly in the scheduler's order, the order the tracker orders
tracked work in across queues.

shadow_standing.rs: a command buffer's last batch, holding its last encoder,
with nothing failed or reaching memory unnamed, records each shadow its end
left holding every texel (ShadowCarry::held_whole) as standing at the write
counts of its keys (the truth's, the host memory it joined, the image's).
Each submitted batch's tracked writes count against those keys; a command
buffer that may reach memory no use names (root tables, executions resolved
from records, unnoted) counts against all. A command buffer's first copy in
of such a shadow, before its encoder wrote what it reads, goes to its batch's
submission (GatedCopyIn with CopyGate::Standing) and moves nothing where the
shadow stands and no earlier encoder of the command buffer wrote its keys. A
buffer whose VkBuffer was handed out never stands (Buffer::vk_buffer's doc
says so). Counted: WorkCounts::shadow_copies_in_against_standing,
shadow_copies_in_skipped_by_standing, shadow_texels_skipped_by_standing.

Verified: to build and run on the M3 (tests::shadow_standing_device: a later
read skips; another queue's fill lets go and reaches the texture; a write
through the texture reaches the buffer, its gaps kept; a fill earlier in the
same command buffer copies in; a handed-out VkBuffer never stands).

(cherry picked from commit 255f77bc0efcdc166031aadec328669d77e6075e)
2026-11-05 13:14:46 -08:00
..