A pipeline a list binds again is not kept and named again (from Belobug 92d353f8, romainhedouin)

Two queries for an interface, three locks and a name looked up at every
change of pipeline; now one lookup by address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 15:42:59 -06:00
1 parent b32fb9975d
commit ab86ef7f3f
2 files changed
+18 -3

No files matched your search

+1 -3
View File
@@ -1460,10 +1460,8 @@ impl State {
// SAFETY: an open list and a live pipeline.
unsafe { l.SetPipelineState(&p.pso) };
self.host_pipeline = p.pso.as_raw() as usize;
list.used_pipeline(&p.name);
// The title may release the pipeline before it submits the list.
list.keep(&p.pso);
list.keep(&p.root);
list.bind_pipeline(&p.name, &p.pso, &p.root);
}
for stage in &p.stages {
let t = stage.translated();
+17
View File
@@ -2181,6 +2181,8 @@ struct Deferred {
/// descriptor heaps): the title may release its objects before it
/// submits the list.
kept: Vec<windows::core::IUnknown>,
/// The pipelines [`HostList::bind_pipeline`] kept, by address.
bound: std::collections::HashSet<usize, std::hash::BuildHasherDefault<AddressHash>>,
/// Buffer ranges refreshed since the last title copy (host copy,
/// address, bytes): refreshing them again would find the same bytes.
refreshed: std::collections::HashSet<(usize, usize, usize), std::hash::BuildHasherDefault<AddressHash>>,
@@ -6624,6 +6626,21 @@ impl HostList {
}
}
/// The list binds a pipeline: it and its root signature are kept until
/// the list is reset, and its name noted, the first time only (a kept
/// pipeline's address names no other).
pub(crate) fn bind_pipeline(&self, name: &str, pso: &ID3D12PipelineState, root: &ID3D12RootSignature) {
{
let mut deferred = self.deferred();
if !deferred.bound.insert(pso.as_raw() as usize) {
return;
}
deferred.kept.push(pso.clone().into());
deferred.kept.push(root.clone().into());
}
self.used_pipeline(name);
}
fn deferred(&self) -> std::sync::MutexGuard<'_, Deferred> {
self.deferred.lock().unwrap_or_else(|e| e.into_inner())
}