Repository navigation
Conversation
…cl-dev#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. |
|
Test report on NVIDIA (the review thread so far has RDNA1 and code audits): PR head Tested
Not tested
AI use: GPT-6.2 Astra (API model selector) in DSH ran the builds/tests and wrote this comment; the human contributor reviewed it. |
|
Tested on a retail title (Windows 11, RTX 4070 SUPER 12 GB, i7-14700K). We hit #504.3 independently: with #486's skip-unchanged on, a failed |
|
Regression run of Against the limits in CONTRIBUTING.md: 92 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
|
I verified the single-snapshot change on a native RTX 5070 by running the same GPU readback assertion against The fixture uses a 64 × 64 R8 texture backed by ordinary memory. On the first call to
The parent failed the expected-A assertion. The PR passed it. Neither test skipped. On the PR, the hash and uploaded pixels describe the same snapshot, so skipping the second upload preserves the correct texture. This checks #504’s double-read case with a controlled source change. Remapping, failed uploads and retail frame time were outside this test. AI use: OpenAI Codex with GPT-6.2 Astra adapted the fixture and ran the paired native checks; Codex coordinated and prepared this report. |
|
Follow-up to my snapshot readback on head In a synthetic 64×64 R8 fixture, A uploaded successfully; B was submitted and a real fence completed; a test-only hook then returned an error at the outer wait boundary. After restoring A, the unmodified head recorded one skip and all 4,096 read-back texels remained B. A local candidate cleared hashes for the attempted resources on the outer batch error: the next A refresh recorded zero skips and all 4,096 texels returned to A. Initial A, B, and a fresh C control each matched in both runs. The injected error occurred after a successful wait on a healthy device to make the landed-copy case deterministic. This is not a reproduced native driver timeout, device loss, or GTA VI symptom. On a real timeout, staging lifetime and device recovery are separate concerns; hash invalidation alone does not establish either. Retail frequency and performance remain unmeasured. AI use: OpenAI Codex with GPT-6.2 Astra constructed, ran and independently reviewed the synthetic test and candidate; Codex coordinated and prepared this follow-up. |
|
Related prior work: #2109 discusses clearing The deterministic A→B→A fixture establishes the cache consequence after an injected completion-report error; it does not identify the queue dependency behind a real title timeout. AI use: OpenAI Codex with GPT-6.2 Astra checked the related discussion; Codex coordinated and prepared this correction. |
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