Only changed dwords go back into title memory; cheap safe copies; title's own arguments; more shader forms

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 20:28:42 -06:00
1 parent 7913a98a3d
commit 66afb2b4cb
16 files changed
+973 -29

No files matched your search

+18
View File
@@ -5824,6 +5824,11 @@ pub(crate) fn read_into(src: *const u8, dst: &mut [u8]) -> bool {
fn read(src: *const u8, dst: *mut u8, len: usize) -> bool {
use windows_sys::Win32::System::Diagnostics::Debug::ReadProcessMemory;
use windows_sys::Win32::System::Threading::GetCurrentProcess;
if crate::safecopy::on() {
// SAFETY: the destination is mapped writable memory of `len` bytes;
// a source page that is not there fails the copy.
return unsafe { crate::safecopy::copy(dst, src, len) };
}
let mut done = 0;
// SAFETY: the destination is mapped writable memory of `len` bytes; the
// kernel checks the source.
@@ -5863,6 +5868,11 @@ pub(crate) fn write_mapped(dst: *mut u8, src: *const u8, len: usize) {
let direct = direct_writes();
let write = |at: usize, n: usize| {
let from = src.wrapping_add(at - dst as usize);
if crate::safecopy::on() {
// SAFETY: the source is ours; a destination page that is not
// there, or not writable, fails the copy.
return unsafe { crate::safecopy::copy(at as *mut u8, from, n) };
}
let mut done = 0;
if direct {
// SAFETY: as below; the kernel checks the destination and
@@ -6227,6 +6237,14 @@ impl Meter {
#[cfg(feature = "diagnostics")]
{
log_blame(frames);
let put = [0, 1, 2, 3].map(|i| crate::shadow::PUT[i].swap(0, Ordering::Relaxed) as f64 / frames);
tracing::info!(
"what shaders wrote put into title memory per frame (VICTORY_EXACT_BACK): {:.0} pieces in {:.0} writes, {:.1} MB; {:.0} pieces joined over gaps",
put[0],
put[1],
put[2] / 1e6,
put[3]
);
crate::copystat::log(std::mem::take(&mut self.copy_stats_frames) as f64);
for (why, n) in drops.iter().take(40) {
tracing::info!(