Record Vulkan commands off the encoding thread through deferred command buffers the recorder replays

Encoders log their commands into deferred command buffers, and the device's recorder thread replays
them into Vulkan once the command buffer is committed, so the encoding thread no longer calls the
driver for each command. Every recorded command goes through a slot of its device's; the recorder's
queue and the scheduler's inbox are sized for a frame's commits and grow ahead of them on the
recorder's thread; a commit's end allocates nothing; a render pass instance's secondary that nothing
executes is never replayed. The replays' commands are counted by kind, and the recorder's modules
are listed among those that may keep the device's functions.

Folds in:
- Route every command the runtime records through a slot of its device's
- List recorder/mod.rs among the modules that keep the device's functions
- List recorder/thunks.rs among the modules that keep the device's functions
- Record Vulkan commands off the encoding thread: encoders log into deferred command buffers, the
  device's recorder thread replays them once committed
- Grow the recorder's queue ahead of the commits, on the recorder's thread
- Give the scheduler's inbox and the recorder's queue room for a frame's commits from their making
- Count the commands the recorder's replays call, by kind
- Give a commit's tail log its fold's room when its encoder ends
- Never replay a render pass instance's secondary that nothing will execute
- Give new replays room to end each deferred command buffer as it is made, so a commit's end
  allocates nothing

Verified by each folded change's own checks; the tree this series ends on is the one verified
at the tip on six GPUs, the CPU suites and lint (see the tables commit).
This commit is contained in:
Anees Iqbal committed 2026-10-19 00:16:00 +03:00
1 parent 8e4f847155
commit c9b0d74912
34 files changed
+4244 -108

No files matched your search

@@ -179,7 +179,10 @@ impl State {
// Held weakly until the first submission, as the commit held what the first recording
// took, and by its replays until they are replayed: what they held last goes here, as
// it does without them (`Replays::hold`, with `device`, the device's functions).
match self.replays.clone() {
Some(replays) => drop(replays.hold(device, |pages| taken.wait(pages))),
None => taken.wait(&mut Vec::new()),
}
let recorded = &mut self.recorded[part];
recorded.raws = raws;
recorded.summary = summary;