|
@@ -2190,6 +2190,9 @@ struct Deferred {
|
|
|
/// memory (host copy, address, bytes): declaring them again would
|
|
/// memory (host copy, address, bytes): declaring them again would
|
|
|
/// change nothing.
|
|
/// change nothing.
|
|
|
gpu_written: std::collections::HashSet<(usize, usize, usize), std::hash::BuildHasherDefault<AddressHash>>,
|
|
gpu_written: std::collections::HashSet<(usize, usize, usize), std::hash::BuildHasherDefault<AddressHash>>,
|
|
|
|
|
+ /// Scratch memory [`HostList::fill_scratch`] fills since the list last
|
|
|
|
|
+ /// wrote title memory (source, bytes): its host address.
|
|
|
|
|
+ filled: std::collections::HashMap<(usize, usize), u64, std::hash::BuildHasherDefault<AddressHash>>,
|
|
|
/// Textures whose contents the list brings up to date.
|
|
/// Textures whose contents the list brings up to date.
|
|
|
textures: std::collections::HashSet<usize>,
|
|
textures: std::collections::HashSet<usize>,
|
|
|
/// Bottom-of-pipe writes, done once the list has run: address, what,
|
|
/// Bottom-of-pipe writes, done once the list has run: address, what,
|
|
@@ -2230,6 +2233,7 @@ impl Deferred {
|
|
|
fn title_written(&mut self) {
|
|
fn title_written(&mut self) {
|
|
|
self.refreshed.clear();
|
|
self.refreshed.clear();
|
|
|
self.gpu_written.clear();
|
|
self.gpu_written.clear();
|
|
|
|
|
+ self.filled.clear();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -6676,6 +6680,21 @@ impl HostList {
|
|
|
.push(Step::Fill(dst as usize, src as usize, len, None));
|
|
.push(Step::Fill(dst as usize, src as usize, len, None));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// The host address of `len` bytes of scratch memory that hold the title
|
|
|
|
|
+ /// memory at `src` as of the list's submission: one fill for every ask
|
|
|
|
|
+ /// until the list next writes title memory.
|
|
|
|
|
+ pub(crate) fn fill_scratch(&self, src: *const u8, len: u64) -> Option<u64> {
|
|
|
|
|
+ let key = (src as usize, len as usize);
|
|
|
|
|
+ let known = self.deferred().filled.get(&key).copied();
|
|
|
|
|
+ if known.is_some() {
|
|
|
|
|
+ return known;
|
|
|
|
|
+ }
|
|
|
|
|
+ let (gpu, to) = self.scratch(len)?;
|
|
|
|
|
+ self.defer_fill(to, src, len as usize);
|
|
|
|
|
+ self.deferred().filled.insert(key, gpu);
|
|
|
|
|
+ Some(gpu)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// As [`HostList::defer_fill`], for upload memory that only `slot` (a
|
|
/// As [`HostList::defer_fill`], for upload memory that only `slot` (a
|
|
|
/// title heap's address, and the slot) shows.
|
|
/// title heap's address, and the slot) shows.
|
|
|
pub(crate) fn defer_constants(&self, dst: *mut u8, src: *const u8, len: usize, slot: (usize, u32)) {
|
|
pub(crate) fn defer_constants(&self, dst: *mut u8, src: *const u8, len: usize, slot: (usize, u32)) {
|