D3D12.X: fix title texture skip hash on remap, one read, no poison (#504) #508
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!508
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-508"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Grimkaaah on GitHub · 2026-11-24 01:06 UTC · original
Grimkaaah:fix/504-title-textures-content-hash→main· +85 −24 · 1 files · 1 commits · openSummary
LAST_CONTENTfor every texture into_unmap/to_remapso a remapped texture is re-uploaded even when its CPU bytes are unchanged (#504.1).subresources_fromshare the same snapshot (no double-read / TOCTOU) (#504.2).upload_batchsucceeds for that item — a failed upload no longer poisons the skip cache (#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@thehollowedone on GitHub · 2026-11-24 01:10 UTC · original
The upload path now reads title memory once. There’s one more full copy of the detiled bytes on each cache miss:
subs.clone()duplicates every subresource’s ownedVec<u8>while the original batch is still live. Couldupload_allpush(r, subs, states)directly into the upload list and append(res_key, h)to a parallel list at the same point? That keeps the failure indices aligned and moves the bytes into the batch once. Batch construction at 61ee2a2 · Subresource definitionTested
On the same commit,
cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --test-threads=1 --nocapturepassed 9 tests, with 0 failures, 0 ignored and no reported skips. XCL selected the RTX 3080 Ti (621.35). Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug.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.
@Abdellah-Khanani on GitHub · 2026-11-24 01:24 UTC · original
Tested on AMD RDNA1: no new failures.
cargo test --workspace --no-fail-fast -- --test-threads=4on this PR's head61ee2a2(on top of currentmain7ebf1b8): 677 passed, 1 failed, 41 ignored. Onmain7ebf1b8alone: 676 passed, 1 failed, 41 ignored.gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction. It fails onmainon this adapter too and is unrelated (#472).last_content_is_not_poisoned_by_a_hash_check_alone,a_texture_with_unchanged_memory_is_left_out_until_it_is_forgottenand the other 7title_texturestests pass. On this adapterplaced_title_textures_share_vram_and_preserve_pixelsis SKIPPED onmain(the driver refuses the reserved cube; see #470), so it does not cover this change here.gpu_geometry_mode_es_gs_strip,gpu_mesh_mode_two_passes(no mesh shaders).upload_batchpushes(k, e)), so thefailed_idxmapping tokeysis right.Tested with Claude Code (Claude Opus 5.5); the run was on my machine.
@gta5all on GitHub · 2026-11-24 01:27 UTC · original
Review of
8d09824's diff againstmain(69f0635). The three fixes match #504, and reading the memory once and slicing it gives the same bytes as the old per-sliceread_committedcalls (size()coversarray × slice_bytes, and bytes past the end read as 0 indetile_level/detile_volume). Two things I'd change before it is merged:1. Every batch's detiled data is copied once more.
upload_itemsclones each item'sVec<Subresource>(up toBATCH_BYTES, 256 MiB, per batch) only to drop the two extra tuple fields. That gives back much of what reading once saves. Keepingbatchas the tupleupload_batchtakes, with the keys in a separate vec, avoids the copy:(with
let mut keys = Vec::new();next tolet mut batch = Vec::new();). Smaller point: withXCL_TEXTURE_SKIP_UNCHANGED=0the hash is still computed for every upload.let h = if unchanged_skip() { content_hash(&mem) } else { 0 };only remembers a dummy hash that is never compared.2. No test fails without the fix for #504.1.
last_content_is_not_poisoned_by_a_hash_check_alonechecks the helpers only. The placement test misses the remap case because it writes a new pattern (0xD4) before the refresh that followsdrop(new_res). Restoring the old texture's memory to what it held at its last upload shows the bug: B's0x55write lies insideold_res, so rewriting0xAAgives the bytes ofold_res's last upload while its remapped tiles hold B's data. Without theLAST_CONTENTremoval inforget, this upload is skipped and the assert fails:Also: the multi-line reformatting of the two
Subresource { .. }expressions insubresources_fromis churn CONTRIBUTING asks to leave out. And thePR descriptioncheck fails because the description has no Tested (full GPU suite counts), Regression run (the twoxcl-smokeblocks), Not tested or AI use sections.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.
@Alpha325 on GitHub · 2026-11-24 01:36 UTC · original
I ran the unchanged-source remap regression suggested in review. I applied the same local test-only edits to base
7ebf1b8and PR head61ee2a2.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
refresh, and compares the old texture’s GPU readback byte for byte.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
placed_title_textures_share_vram_and_preserve_pixels, since the existing fixture writes a different pattern after remapping.Tested: Radeon RX 9060 XT, driver
32.0.32029.2010, Windows 11, Rust 1.100.0 MSVC x64, release. The PR’s texture test module passed 9/9 with the fixture and no skips. This check covers remap invalidation, not upload-failure handling or snapshot performance.AI use: OpenAI Codex (GPT-6.2 Sol) wrote the local fixture, ran the tests, and drafted this report.
@ryosen0 on GitHub · 2026-11-24 01:57 UTC · original
Test report on NVIDIA (the review thread so far has RDNA1 and code audits): PR head
61ee2a2merged ontomain508a0c7(clean merge), release build, RTX 3060 Ti 8 GB (wave32), Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11.Tested
cargo test -p xcl --lib -- --test-threads=1 title_textures xaudio2 acphalon the merge with #468 and #456 also applied (all three touch adjacent paths): 27 passed, 0 failed - including the three newLAST_CONTENTtests (last_content_is_not_poisoned_by_a_hash_check_alone, the unchanged-remap regression, the one-read snapshot).title_texturesGPU tests (gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes,placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submitted) pass serially on this adapter. Under--test-threads=4the same set fails on a poisoned lock on unmodified main too (documented in #516's report) - worth running GPU tests serially when reporting counts.XCL_NETWORK=0 XCL_ACTIVITY=1): the game exited cleanly on its own at t≈34 s during shader warm-up (exit 0x0, no crash, no device removal) - the early-exit behaviour varies run to run on this title; nothing in the log points at the skip path. Not counted as a regression signal either way.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.
@jacksonslab on GitHub · 2026-11-24 03:23 UTC · original
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
upload_queue/upload_batchleft the content hash recorded, so the texture was never uploaded again. We had a local fix that only forgot the hash on failure; this PR's version is strictly better (also covers remaps with unchanged bytes and the double read). We've replaced our fix with this PR in our test build;title_texturestests pass.@Toons29 on GitHub · 2026-11-25 02:56 UTC · original
Regression run of
61ee2a28on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 92 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@DavidM1911 on GitHub · 2026-11-25 13:53 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.