Say what an indirect command holds of the pipeline state set on it

The steps this packet landed as, in order:
- Time indirect commands' CPU setters and getters in host_ab
- Read and write one field of an indirect command's record
- Set and read an indirect command's fields one at a time
- Call an indirect execution's check where it may see something, and run the CPU's later writes
- Load vkGetDescriptorSetLayoutSupport inside the exit guard's sections
- Hand out indirect command buffer IDs to 2^31 - 1 and place every one's records, as an M3 Max does
- Refuse an indirect command buffer reservation Metal hangs at as such
- Place an indirect command buffer's records at any length, found only at their start
- Leave a resource ID pool made after a reservation of 0 alone, as Metal does
- Ignore a late reservation call before looking at what it holds, as Metal does
- Expect the merged-draw tests' pipeline makings' notices on every device
- Keep an indirect compute command's threadgroup lengths where Metal keeps them
- Take the pieces of the ICB identifier range Metal's encoders take
- Answer a GPU-written command's state identifier as the state its ID named then
- Run a GPU-written record's released state as Metal does, from the buffer's kept programs
- State and test the bound on the programs a GPU-writable buffer keeps
- Record the earlier-window record of a re-held ID as a known gap

Content: the tree of `development` at 7d31ebb207, unchanged.
This commit is contained in:
Anees Iqbal committed 2026-10-26 13:19:05 +02:00
1 parent c83dcdd384
commit 9516e41497
65 files changed
+5357 -1307

No files matched your search

@@ -91,6 +91,7 @@ use super::sparse::indirect::{self, ReadFailure};
use super::texture::storage_form::Riding;
use super::texture::Texture;
use super::tracker::Footprint;
use super::unique_identifier::ScheduledWork;
use super::upload::{Upload, Uploads};
use super::used_resources::{names_any, EncoderKind, EncoderRecord, Reached, ReadRecord};
use super::values::CommandBufferStatus;
@@ -529,6 +530,9 @@ pub(super) struct State {
/// Its scheduled handlers ran: `wait_until_scheduled` returns, as Metal's does only once
/// they ran.
scheduled_ran: bool,
/// What its encoders did that Metal's identifier allocations follow as it is scheduled
/// (`unique_identifier.rs`).
scheduled_work: ScheduledWork,
/// The threads sleeping on its `changed` condition variable: a change wakes it only where
/// one does ([`CommandBufferShared::wake_parked`]).
parked: usize,
@@ -1610,6 +1614,7 @@ impl CommandBuffer {
submission: VecDeque::new(),
submitting: false,
scheduled_ran: false,
scheduled_work: ScheduledWork::default(),
parked: 0,
failure: None,
completed: VecDeque::new(),
@@ -1699,6 +1704,14 @@ impl CommandBuffer {
}
/// The state, locked.
/// Note `work` of an encoder it ended, which its scheduling hands to the device's identifier
/// allocations ([`UniqueIdentifiers::scheduled`](crate::unique_identifier::UniqueIdentifiers::scheduled)).
pub(super) fn note_scheduled_work(&self, work: ScheduledWork) {
let mut state = self.state();
state.scheduled_work.dispatch |= work.dispatch;
state.scheduled_work.render |= work.render;
}
pub(super) fn state(&self) -> MutexGuard<'_, State> {
lock(&self.0.state)
}
@@ -3042,8 +3055,12 @@ impl CommandBufferShared {
summaries.push(&encoder.summary);
for segment in &encoder.segments {
match &segment.recorded {
// One recorded again on the GPU alone uses what its recording does.
Some(recording) if !segment.needs_step() || segment.rerecords() => {
// One recorded again on the GPU alone uses what its recording does; one a
// route outgrew, what its host step finds.
Some(recording)
if !segment.needs_step()
|| (segment.rerecords() && !segment.work.outgrown()) =>
{
summaries.push(&recording.summary)
}
_ => known.push(segment.known_summary(&self.device)?),
@@ -3102,11 +3119,17 @@ impl CommandBufferShared {
if steps.is_empty() {
return;
}
// The first segment a host step records, which the device announces: a recording on the
// GPU alone made again announces nothing (`gpu_execute::Rerecord`).
// The first segment a host step records for what the GPU may write, which the device
// announces: a recording on the GPU alone made again announces nothing
// (`gpu_execute::Rerecord`), unless a route outgrew it (`Deferred::outgrown`), which the
// step records from the records; nor does work recorded again for the CPU's writes since
// the commit alone (`Deferred::rewritten`), or for its pipelines alone.
let announced = steps
.iter()
.find(|(_, _, inputs)| !matches!(inputs, Some(StepInputs::Rerecord(_))))
.find(|(_, work, inputs)| {
work.gpu_written()
&& (!matches!(inputs, Some(StepInputs::Rerecord(_))) || work.outgrown())
})
.map(|(_, work, _)| work.clone());
let buffer = CommandBuffer(Arc::clone(self));
for ((encoder, at), work, inputs) in steps {
@@ -3648,6 +3671,12 @@ impl CommandBufferShared {
}
state = lock(&self.state);
}
// Metal's dispatch and render work take their identifier allocations as the command
// buffer is scheduled, before its status reads so (`unique_identifier.rs`).
self.device
.shared()
.identifiers
.scheduled(state.scheduled_work);
state.status = CommandBufferStatus::Scheduled;
self.answer(&state);
}