Files
metal2vulkan/crates/metal2vulkan-runtime/examples
Anees Iqbal 164fdf475f Queue a staging-queue texture's first move and zeros instead of waiting at create
A texture that copies on the staging queue (a transfer-only family, NVIDIA's)
took its first layout move and its zeros in a staging submission of its own,
which new_texture waited for on the host (FirstMove::record_alone): the
consumer measured 0.95 ms p50 and 26.8 ms at most for a Managed texture's
creation on an RTX 5080.

Now the move goes into the staging queue's batch (texture/staging_copy.rs's
Queued) as the texture is registered, under the registration lock and before
its slot write, and rides the next flush: its first replaceRegion's copy
(recorded after it, a transfer write-to-write barrier between them when the
image repeats), the next batch's or internal submission's flush (which the
queue then waits for on the GPU), or a host read, hand-out or settle (waited
on the host). Runs of moves share one barrier (FirstMove::record_several). The
zeros come from one device-wide zero buffer (Device::staging_zeros) instead of
a buffer per texture. The burst bound of copies and bytes holds the moves too.

So every read of a fresh texture still answers its zeros, and a first copy
lands after them: both ride one ordered queue. FirstMove::record_alone and
Device::submit_staging go: nothing uses them now.

WorkCounts::staging_moves_queued counts the moves queued (api_signatures
blessed for the field; host_ab lists it).

Verified on the M3 (MoltenVK, no transfer-only family, so the staging path
does not run there and its counts do not move): staging_batches, first_use and
heap_layouts lanes, 27 passed; conformance replay of the 22 fresh-texture-*
cases exact; cost --alone --show of the 2d rgba8unorm managed and shared
cases: no count moved. fmt, clippy plain and --cfg m2v_gpu, and the release
check with --cfg m2v_gpu are clean. The 5080 legs (counts, before and after,
the negative control) run on msi.

(cherry picked from commit cad7056ecee2416d0e57d6db41b0cfdee07e3523)
2026-11-04 18:50:29 -08:00
..