Repository navigation
Conversation
…vall#504) Clear LAST_CONTENT on unmap/remap; hash and detile from one read_committed snapshot; remember hashes only after a successful upload_batch entry. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The upload path now reads title memory once. There’s one more full copy of the detiled bytes on each cache miss: Tested On the same commit, Not tested Full workspace, retail titles, and the performance impact of removing the copy. AI use Codex with GPT-6.2 Astra reviewed the upload path, ran the tests and drafted this report. |
|
Tested on AMD RDNA1: no new failures.
Tested with Claude Code (Claude Opus 5.5); the run was on my machine. |
|
Review of 1. Every batch's detiled data is copied once more. - batch.push((r, subs, states, res_key, h));
+ batch.push((r, subs, states));
+ keys.push((res_key, h));- let upload_items: Vec<_> = batch.iter().map(|(r, subs, states, _, _)| (r.clone(), subs.clone(), states.clone())).collect();
- let keys: Vec<_> = batch.iter().map(|(_, _, _, res, h)| (*res, *h)).collect();
match own_work(|| {
super::vram::before_execute(&queue);
- texture::upload_batch(dev, &queue, &upload_items)
+ texture::upload_batch(dev, &queue, &batch)
}) {(with 2. No test fails without the fix for #504.1. drop(new_res);
+ write_tiled(base, &old_desc, 0xAA); // the bytes of old_res's last upload, before B
+ refresh(queue.as_raw());
+ assert_eq!(read_sub(&old_res, 0), subresources(base, &xg::Texture::new(&old_desc).unwrap())[0].data, "#504.1: remapped texture with unchanged memory is uploaded again");
write_tiled(base, &old_desc, 0xD4);Also: the multi-line reformatting of the two Static review only: I did not build or run this (no Windows machine here). The diffs above are suggestions to check, not tested code. Written with Claude Code (Claude Opus 5.5), under human review. |
|
I ran the unchanged-source remap regression suggested in review. I applied the same local test-only edits to base The fixture uploads a 512×512 RGBA8 texture, then places and uploads a smaller texture over part of its address range. While the old texture is still shadowed, the fixture restores the exact CPU bytes from its first upload. It then releases the overlapping texture, calls
The cache-disabled control isolates the cause: identical CPU bytes do not mean the remapped GPU tiles still contain the old texture. The PR forces the upload and restores the full readback. I’d add this case to Tested: Radeon RX 9060 XT, driver AI use: OpenAI Codex (GPT-6.2 Sol) wrote the local fixture, ran the tests, and drafted this report. |
Summary
LAST_CONTENTfor every texture into_unmap/to_remapso a remapped texture is re-uploaded even when its CPU bytes are unchanged (D3D12.X: title_textures content hash skips remapped textures, double-reads changed textures, and caches failed uploads (#486) #504.1).subresources_fromshare the same snapshot (no double-read / TOCTOU) (D3D12.X: title_textures content hash skips remapped textures, double-reads changed textures, and caches failed uploads (#486) #504.2).upload_batchsucceeds for that item — a failed upload no longer poisons the skip cache (D3D12.X: title_textures content hash skips remapped textures, double-reads changed textures, and caches failed uploads (#486) #504.3).Fixes #504
Test plan
cargo test -p xcl --lib hle::d3d12x::title_textures::tests::last_contentcargo test -p xcl --lib hle::d3d12x::title_textures::tests::a_texture_with_unchanged_memory