You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code audit of crates/xcl/src/hle/d3d12x/title_textures.rs on main (69f0635, merged via #486) found three follow-up issues in the unchanged-texture skip path:
Unmapped/remapped shadowed textures stay skipped when their CPU bytes are unchanged (title_textures.rs:392-394, 490-492, 508-512, 831-840):
When texture A is shadowed by an overlapping placement B, register() / retire_range() calls vram::unmap_superseded(A), releasing A's unshared VRAM tiles back to the pool, while LAST_CONTENT still holds A -> hash.
When B is later released, forget(B) removes B (not A) from LAST_CONTENT, reactivates A with A.pending = true, and calls vram::remap_if_unmapped(A).
On the next refresh(), if A's CPU memory still matches its pre-unmap hash, same_as_last_upload(A, h) returns true and skips re-uploading A into its freshly remapped VRAM tiles (the existing test at line 1643 didn't catch this because it overwrites old_res with a new seed 0xD4 before refresh()).
Fix: Remove every resource in to_unmap / to_remap from LAST_CONTENT.
Every changed texture is read and allocated twice (plus TOCTOU between hash and upload) (title_textures.rs:832, 843, 1050-1066):
upload_all calls read_committed(va, tex.size() as usize) to compute content_hash, drops that Vec<u8>, and then subresources(va, &tex) calls read_committed a second time for the exact same memory.
Fix: Read the bytes once into mem, hash &mem, and pass &mem into a subresources_from(&mem, &tex) helper (slicing &mem[s * c.slice_bytes..(s + 1) * c.slice_bytes] for 2D/array slices).
same_as_last_upload inserts h into LAST_CONTENT before upload_queue() or texture::upload_batch() runs. If upload_queue fails, upload_batch returns Err, or an item index k appears in Ok(failed), LAST_CONTENT already recorded h and suppresses future retries until the memory changes.
Fix: Check LAST_CONTENT.get(&res) == Some(&h) before batching, and insert (res, h) only for batch entries that succeeded in upload_batch.
Not tested: on Windows yet (static code audit of 69f0635; preparing a clean fix + RTX 5080 test run next).
Confirmed bug #1 live on Windows 11 / RTX 5080 (main7ebf1b8, rustc 1.100.0 MSVC):
A GPU regression test that uploads old_res (0xAA), shadows/unmaps it with an overlapping placement, releases the overlapping placement without modifying old_res's CPU bytes, and runs refresh() logs title textures: 1 uploads left out so far – the texture's memory held what it held at its last upload and reads back [0, 0, 0, ...] instead of 0xAA.
Have a local fix for all three items (invalidate LAST_CONTENT on unmap/remap, single read_committed + subresources_from, commit hash only after upload_batch succeeds) passing cargo test --workspace -- --test-threads=4: 680 passed, 0 failed, 41 ignored (2 expected no wave64 skips). Waiting to run a clean scripts/smoke.ps1 regression check before opening the PR.
AI use: reproduced and verified with Antigravity (Gemini 4 Neon) on NVIDIA GeForce RTX 5080.
Activity
Grimkaaah commentedon Nov 24, 2026
PR opened addressing all three follow-ups from the audit (LAST_CONTENT on unmap/remap, single read+hash, remember only after successful upload).
Made with Cursor
mastrr9 commentedon Nov 24, 2026
Confirmed bug #1 live on Windows 11 / RTX 5080 (
main7ebf1b8,rustc 1.100.0MSVC):old_res(0xAA), shadows/unmaps it with an overlapping placement, releases the overlapping placement without modifyingold_res's CPU bytes, and runsrefresh()logstitle textures: 1 uploads left out so far – the texture's memory held what it held at its last uploadand reads back[0, 0, 0, ...]instead of0xAA.LAST_CONTENTon unmap/remap, singleread_committed+subresources_from, commit hash only afterupload_batchsucceeds) passingcargo test --workspace -- --test-threads=4: 680 passed, 0 failed, 41 ignored (2 expectedno wave64skips). Waiting to run a cleanscripts/smoke.ps1regression check before opening the PR.AI use: reproduced and verified with Antigravity (Gemini 4 Neon) on NVIDIA GeForce RTX 5080.