|
@@ -289,6 +289,11 @@ struct Waiting {
|
|
|
/// Bytes of its memory that were mapped when it was last uploaded
|
|
/// Bytes of its memory that were mapped when it was last uploaded
|
|
|
/// without all of it there; 0: not uploaded yet.
|
|
/// without all of it there; 0: not uploaded yet.
|
|
|
mapped: u64,
|
|
mapped: u64,
|
|
|
|
|
+ /// For a slot uploaded whole and looked at again
|
|
|
|
|
+ /// ([`TextureQueue::recheck`]): where its memory is (address, bytes),
|
|
|
|
|
+ /// the fingerprint it had at the upload, how many looks found it
|
|
|
|
|
+ /// unchanged, and the frame of the upload. A fingerprint of 0: none.
|
|
|
|
|
+ checked: (u64, u64, u64, u8, u64),
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// The queue of title slots whose texture view waits to be brought up to
|
|
/// The queue of title slots whose texture view waits to be brought up to
|
|
@@ -311,7 +316,7 @@ impl TextureQueue {
|
|
|
}
|
|
}
|
|
|
self.writes += 1;
|
|
self.writes += 1;
|
|
|
let write = self.writes;
|
|
let write = self.writes;
|
|
|
- self.slots.insert(index, Waiting { due, written: frame, write, looks: 0, mapped: 0 });
|
|
|
|
|
|
|
+ self.slots.insert(index, Waiting { due, written: frame, write, looks: 0, mapped: 0, checked: (0, 0, 0, 0, 0) });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fn remove(&mut self, index: u32) {
|
|
fn remove(&mut self, index: u32) {
|
|
@@ -382,6 +387,24 @@ impl TextureQueue {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// Slot `index` was uploaded whole from memory `at` (address, bytes)
|
|
|
|
|
+ /// with fingerprint `print`: looked at again from frame `due`, for a
|
|
|
|
|
+ /// title that fills a texture's memory after it wrote the view (the
|
|
|
|
|
+ /// `looks`-th such look; `uploaded` is the upload's frame).
|
|
|
|
|
+ #[allow(clippy::too_many_arguments)]
|
|
|
|
|
+ fn recheck(&mut self, index: u32, write: u64, due: u64, at: (u64, u64), print: u64, looks: u8, uploaded: u64) {
|
|
|
|
|
+ if let Some(w) = self.same(index, write) {
|
|
|
|
|
+ (w.due, w.looks, w.mapped) = (due, 1, 0);
|
|
|
|
|
+ w.checked = (at.0, at.1, print, looks, uploaded);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// What [`TextureQueue::recheck`] noted of slot `index`, if it is
|
|
|
|
|
+ /// waiting for such a look.
|
|
|
|
|
+ fn checked(&self, index: u32) -> Option<(u64, u64, u64, u8, u64)> {
|
|
|
|
|
+ self.slots.get(&index).map(|w| w.checked).filter(|c| c.2 != 0)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// The memory slot `index`'s texture lies in was mapped, unmapped or
|
|
/// The memory slot `index`'s texture lies in was mapped, unmapped or
|
|
|
/// written in `frame`: the slot is looked at from frame `due` as one
|
|
/// written in `frame`: the slot is looked at from frame `due` as one
|
|
|
/// written now, whatever was known of it (a pass at work on it does
|
|
/// written now, whatever was known of it (a pass at work on it does
|
|
@@ -390,7 +413,7 @@ impl TextureQueue {
|
|
|
self.writes += 1;
|
|
self.writes += 1;
|
|
|
let write = self.writes;
|
|
let write = self.writes;
|
|
|
let due = self.slots.get(&index).map_or(due, |w| w.due.min(due));
|
|
let due = self.slots.get(&index).map_or(due, |w| w.due.min(due));
|
|
|
- self.slots.insert(index, Waiting { due, written: frame, write, looks: 0, mapped: 0 });
|
|
|
|
|
|
|
+ self.slots.insert(index, Waiting { due, written: frame, write, looks: 0, mapped: 0, checked: (0, 0, 0, 0, 0) });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// Bytes of slot `index`'s memory that were mapped at its last upload
|
|
/// Bytes of slot `index`'s memory that were mapped at its last upload
|
|
@@ -845,6 +868,27 @@ impl HostHeap {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// Title slot `index` was uploaded whole: see [`TextureQueue::recheck`].
|
|
|
|
|
+ #[allow(clippy::too_many_arguments)]
|
|
|
|
|
+ pub(crate) fn texture_slot_recheck(
|
|
|
|
|
+ &self,
|
|
|
|
|
+ index: u32,
|
|
|
|
|
+ write: u64,
|
|
|
|
|
+ due: u64,
|
|
|
|
|
+ at: (u64, u64),
|
|
|
|
|
+ print: u64,
|
|
|
|
|
+ looks: u8,
|
|
|
|
|
+ uploaded: u64,
|
|
|
|
|
+ ) {
|
|
|
|
|
+ let mut textures = self.textures.lock().unwrap_or_else(|e| e.into_inner());
|
|
|
|
|
+ textures.recheck(index, write, due, at, print, looks, uploaded);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// See [`TextureQueue::checked`].
|
|
|
|
|
+ pub(crate) fn texture_slot_checked(&self, index: u32) -> Option<(u64, u64, u64, u8, u64)> {
|
|
|
|
|
+ self.textures.lock().unwrap_or_else(|e| e.into_inner()).checked(index)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// Nothing to upload at title slot `index` now (its memory is not
|
|
/// Nothing to upload at title slot `index` now (its memory is not
|
|
|
/// mapped, or no more of it than before): looked at again after 1, 2,
|
|
/// mapped, or no more of it than before): looked at again after 1, 2,
|
|
|
/// 4, ... frames, at most `most`.
|
|
/// 4, ... frames, at most `most`.
|