Merge fork main 310c6eb

Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	crates/victory-gpu/src/indirect.rs
This commit is contained in:
local committed 2026-11-24 21:41:28 -06:00
commit e5f735d6ae
9 files changed
+1807 -32

No files matched your search

@@ -141,10 +141,12 @@ extern "system" fn open_file(_: Factory, path: *const u16, iid: *const Guid, out
tracing::warn!(path = name, %error, "dstorage: opening a file failed");
return from_win32(&error);
}
let kept = name.clone();
tracing::info!(path = name, iid = iid_text(iid), "dstorage: file opened");
// SAFETY: a handle we just opened and nobody else owns.
let file = unsafe { std::fs::File::from_raw_handle(handle) };
let file = Instance::create(Object::new("dstorage file", &FILE_VTABLE), File { file });
WALLS_FILES.lock().unwrap_or_else(|e| e.into_inner()).push((file as usize, kept));
put(out, file)
}
@@ -440,6 +442,52 @@ impl Scheduler {
}
}
/// The walls trace (`VICTORY_WALLS_TRACE`): 0 or unset: off; 1: a line for
/// every read request that fails, with its file; 2: for every request (the
/// list of a launch's reads, by file and offset, is what a launch with the
/// first room's walls and one without are compared by).
fn walls_trace() -> u8 {
static ON: OnceLock<u8> = OnceLock::new();
*ON.get_or_init(|| {
std::env::var("VICTORY_WALLS_TRACE").ok().and_then(|v| v.trim().parse::<u8>().ok()).unwrap_or(0)
})
}
/// The files opened, by the address of our file object, with their paths
/// (for the walls trace: a request names its file by that address).
static WALLS_FILES: Mutex<Vec<(usize, String)>> = Mutex::new(Vec::new());
/// The walls trace's line for a request that is done.
fn walls_request(request: &Request, result: &Result<(), HRESULT>, started: std::time::Instant) {
let level = walls_trace();
if level == 0 || (level == 1 && result.is_ok()) {
return;
}
let file = if request.options & MEMORY_SOURCE != 0 {
"memory".to_string()
} else {
let files = WALLS_FILES.lock().unwrap_or_else(|e| e.into_inner());
let source = request.source as usize;
files.iter().find(|f| f.0 == source).map_or_else(|| "?".to_string(), |f| f.1.clone())
};
let hr = match result {
Ok(()) => 0,
Err(hr) => *hr as u32,
};
tracing::info!(
file,
offset = request.offset,
source_size = request.source_size,
destination_size = request.destination_size,
to_pages = request.options & PAGE_DESTINATION != 0,
options = format_args!("{:#x}", request.options),
ms = started.elapsed().as_millis() as u64,
ok = result.is_ok(),
hr = format_args!("{hr:#010x}"),
"walls trace: a read request is done"
);
}
/// A worker: runs the next read of the most deserving queue.
fn work(scheduler: &'static Scheduler) {
let mut lanes = scheduler.lock();
@@ -451,6 +499,7 @@ fn work(scheduler: &'static Scheduler) {
drop(lanes);
let started = std::time::Instant::now();
let result = execute(&job.request);
walls_request(&job.request, &result, started);
lanes = scheduler.lock();
lanes.finish(&job, result);
lanes.count(&job, started);