Lighter refreshes of host copies; landing past the guards; the heap pass spread

VICTORY_LIGHT_REFRESH (on): view memory nothing wrote since the last asking
is known by a bit a block, copies nothing of which changed wake no thread,
the ends of a range are not copied at every refresh, long copies are split.
VICTORY_LAND_WINDOW=1: what shaders wrote goes into guarded title memory
through a view of ours of the section, the guard stays.
VICTORY_SEND_CHANGED=1: pages taken again go up to the card where they differ.
VICTORY_HEAP_SPREAD (on): a sixteenth of the heap's slots at every pass.
Three log lines split the preparing, the askings and the heap pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 22:03:45 -06:00
1 parent c897fa28ff
commit 2aa8134b59
9 files changed
+1549 -59

No files matched your search

+30
View File
@@ -280,11 +280,41 @@ fn views() -> std::sync::MutexGuard<'static, Views> {
/// The runtime made a section of `bytes` for physical pages; `committed`
/// if with `SEC_COMMIT` (only such a section can be opened as a heap).
pub fn title_memory_section(section: usize, bytes: u64, committed: bool) {
title_memory_section_gone(section);
let mut v = views();
v.sections.retain(|s| s.0 != section);
v.sections.push((section, bytes, committed));
}
/// Views of ours of whole sections, by the section's handle: where.
static WINDOWS: Mutex<BTreeMap<usize, usize>> = Mutex::new(BTreeMap::new());
/// The runtime lets go of a section, and of its handle: no view of it is
/// mapped any more.
pub fn title_memory_section_gone(section: usize) {
let window = WINDOWS.lock().unwrap_or_else(|e| e.into_inner()).remove(&section);
if let Some(base) = window.filter(|&base| base != 0) {
// SAFETY: a view of ours. Who writes through it holds off the
// runtime's unmapping of the view it found the section by
// (`crate::watch::land_through`), which came before this.
unsafe { mem::UnmapViewOfFile(mem::MEMORY_MAPPED_VIEW_ADDRESS { Value: base as *mut c_void }) };
}
}
/// Where a view of ours of all of `section` is, made when first asked for;
/// `None` if the host gives none. The caller holds off remapping
/// (`crate::title_memory_reading`) and found the section in a view the
/// runtime told us of, so the section lives.
pub(crate) fn window(section: usize) -> Option<usize> {
let bytes = views().sections.iter().find(|s| s.0 == section)?.1;
let mut windows = WINDOWS.lock().unwrap_or_else(|e| e.into_inner());
let base = *windows.entry(section).or_insert_with(|| {
// SAFETY: a live section of that many bytes.
unsafe { mem::MapViewOfFile(section as *mut c_void, mem::FILE_MAP_WRITE, 0, 0, bytes as usize) }.Value as usize
});
(base != 0).then_some(base)
}
/// The runtime mapped `[at, at + len)` as a view of `section` from
/// `offset` on. Call after [`crate::title_memory_remapped`] of the range.
pub fn title_memory_view(at: usize, len: usize, section: usize, offset: u64) {