|
|
@@ -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())
|
|
|
}
|