Merge pull request #365 from FIocker/gpu/publish-initialized-descriptor-heap
GPU: replay pending descriptors before publishing the host heap
This commit is contained in:
commit
738fd0efd9
1 file changed
+12
-9
@@ -85,15 +85,18 @@ impl Heap {
|
||||
return None;
|
||||
}
|
||||
let mut pending = self.pending.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let h = self
|
||||
.host
|
||||
.get_or_init(|| host::HostHeap::new(self.samplers(), self.desc.count))
|
||||
.as_ref()?;
|
||||
let step = u64::from(increment(self.desc.kind)?);
|
||||
for i in pending.drain(..) {
|
||||
h.mirror(i, self.start + u64::from(i) * step, false);
|
||||
}
|
||||
Some(h)
|
||||
// A recorder can take the fast path as soon as the OnceLock is
|
||||
// initialized. Publish only after replaying the queued writes.
|
||||
self.host
|
||||
.get_or_init(|| {
|
||||
let step = u64::from(increment(self.desc.kind)?);
|
||||
let h = host::HostHeap::new(self.samplers(), self.desc.count)?;
|
||||
for i in pending.drain(..) {
|
||||
h.mirror(i, self.start + u64::from(i) * step, false);
|
||||
}
|
||||
Some(h)
|
||||
})
|
||||
.as_ref()
|
||||
}
|
||||
|
||||
/// The descriptor index of `handle` in this heap, if it lies in it.
|
||||
|
||||
Reference in new issue
Block a user