Packed textures stay in the upload queue; a texture on the card is refreshed when the card is full
Two fixes for textures that shaders pick by index, both proven with a slot listing before they were made: - The title keeps only a texture's small levels and places the next texture in the address range of the absent large ones. Described at full size every neighbour overlapped, and each view written took the textures beside it out of the upload queue and made their host slots null (tens of thousands of slots a run). A newer view now makes an older one stale only when it starts within that one's first 4 KiB. VICTORY_STALE_TEXTURES=overlap: the old rule; =0: never. Unit tests on the span table alone. The first room is lit with its walls and the characters' textures in the first launch with it. - With the card at its limit, a texture that already has its host copy is uploaded again when the title changed its memory (it took no new card memory, and was refused all the same). VICTORY_REUPLOAD_WHEN_FULL=0: as before. Logging only, off unless asked for: both video memory groups and budget moves; card accounting (VICTORY_CARD_ACCOUNTING=1); the slots a listed draw's shaders read, with their state (VICTORY_LIST_SLOTS=); a trace for the missing first-room walls (VICTORY_WALLS_TRACE=1 or 2). A card test of what a bare command costs (ignored by default): cargo test -p victory-gpu --release -- --ignored bare_command_cost --nocapture Known: about 3 to 5 frames a second; more than half of the texture memory on the card is held for levels the title has not loaded yet (next). Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
d8bd2af52e
commit
8d3ce0190f
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);
|
||||
|
||||
Reference in new issue
Block a user