Files
metal2vulkan/crates
Anees Iqbal e23ac486be Runtime: an indexed draw's command buffer keeps its index buffer until it retires
The draw path kept an indirect draw's arguments' buffer (and an execution's
range buffer) with Building::keep, but never the index buffer of
draw_indexed_primitives or draw_indexed_primitives_indirect, though both docs
say the command buffer keeps it until it retires, as Metal's command buffer
retains what its draws use. A buffer is a view of a block that holds the block
(buffer.rs), so where the buffer was its block's last holder (the consumer's
plain buffers: it drops its block handle once the buffer is made), dropping it
after encoding gave the block back at once (memory.rs Pool::give_back): its
range was a free range of its allocation, a later take could land there and
overwrite the indices before the GPU read them, and with nothing in flight the
allocation itself could go once idle. The index buffer is now kept beside the
arguments' buffer, after the draw's checks and only for a draw that records.

Test: every_device_keeps_index_buffers_dropped_before_the_commit_until_their_draws_retire
(tests/draw.rs): a direct indexed draw and an indexed indirect draw, each index
buffer the one holder of a Shared block, both dropped after encoding and before
the commit, two blocks of the same length then taken and filled with other
indices; the target reads back exact (each half its own draw's colour), neither
block is back in the pool before the retirement, and both are after it.
2026-11-22 19:36:05 -08:00
..