Files
metal2vulkan/crates
Anees Iqbal 467e7441ef Runtime docs: what with_present_queue's closure may wait for, by its reason
The contract said `f` "waits for no work of the runtime's". By its words that forbids a
vkQueueWaitIdle on the presenting queue, which a consumer runs under the lock where its
device has no present fences, and which Vulkan requires to run with the queue externally
synchronized. It now says what holds. `f` waits for nothing that needs a thread of the
runtime's or the lock it holds. A wait for work already submitted ends. Where the family
has one queue, the wait holds every submission of the runtime for its length.

The reason a wait for submitted work ends (files read at 0c0aab0df9): no batch the runtime
submits waits on a signal that only a later submission gives.
- Search: `git grep -n -E 'wait_semaphore_infos|wait_semaphores\(|p_wait_semaphores|queue_bind_sparse|queue_submit2?\('`
  over crates/metal2vulkan-runtime/src, tests excluded. Its submission hits: submit.rs:2803
  and :2824, and import.rs:335. The other hits are host-side semaphore waits.
- A submission's only semaphore waits are its first segment's wait for a sparse bind
  (submit.rs:2783-2791, `Sparse::owed`). That bind's signal was submitted earlier, by
  vkQueueBindSparse under the same runtime-queue lock (import.rs:308-341), before `owed`
  is set.
- A bind sparse waits on nothing.
- Segments stage signals only (submit.rs:2278-2311, `stage`).
- encodeWaitForEvent submits no semaphore wait: the submit thread holds the segment until
  the event's value is reached (command.rs:557-563).
- The runtime makes no present and no acquire call: zero hits for queue_present and
  acquire_next_image outside the tests.

Docs only, outside pin 1b908464ea.
2026-11-26 18:02:57 -08:00
..