D3D12.X: keep PENDING accurate for shadowed entries in recheck_gpu_view_sources #1284
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1294"
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?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T14:24:34Z.
Tablemaintains the invariant thatPENDINGcounts only active (by_res) entries withpending == true:Table::insertsubtracts 1 when moving a pending entry intoshadowed,Table::remove/retire_rangedo not subtract when removing a shadowed entry, andTable::removeadds 1 when uncovering a pending shadowed entry.recheck_gpu_view_sourcespreviously calledrecheck_source()on bothby_resandshadowedand incrementedPENDINGdirectly for both, permanently leakingPENDINGwhenever a shadowed GPU-view texture's source changed (both when later removed while shadowed and when uncovered and counted a second time), permanently disabling thedirty_len == 0 && PENDING == 0fast path inrefresh_once.This moves source rechecking into
Table::recheck_sources -> (changed, pending_delta)counting onlyby_resentries, and appliesdeltathroughadjust_pending(matchingTable::insert/Table::remove).What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs: addTable::recheck_sources, return(changed, newly_pending)fromrecheck_source, and applypending_deltainrecheck_gpu_view_sources; add unit testrecheck_sources_keeps_pending_exact_for_shadowed_entriescovering both shadowed-removal and uncover-then-remove paths.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib recheck_sources_keeps_pending_exact_for_shadowed_entriesanda_lazily_mapped_page_in_a_gpu_view_is_its_own_source: both passRegression run
main:
PR:
Not tested
AI use
title_textures.rs, wrote the fix and regression test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:33:32Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:39:32Z.
Full-suite run on NVIDIA and AMD to go with the subset check above. Tested exact head
554cf14(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.recheck_sources_keeps_pending_exact_for_shadowed_entries.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:02:01Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T10:55:59Z.
Independent Windows run on 554cf14. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, debug.
cargo build --offline --locked --workspacepassed.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 752 passed, 0 failed, 41 ignored, with two wave64 skips included in Cargo's pass count.I extended the synthetic GPU mirror test in a scratch copy. Two committed D3D12 textures had independent GPU allocations and overlapping title-memory ranges. I mapped a new source while the older texture was shadowed, let the covering texture's uploads finish, then removed it. The restored texture read back 4,096/4,096 new pixels. The pending upload count was 0 → 0 → 0 before the map, while shadowed, and after the restored texture uploaded.
The same fixture on #1733’s 44089a2 left all 4,096 old pixels in place with counts of 0 → 0 → 0. Restoring the original pending update in that checkout refreshed all pixels and left the count at 0 → 1 → 1.
cargo test --offline --locked -p xcl --lib gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes -- --nocapture --test-threads=1passed 1/0/0 with zero fixture skips on #1294. Synthetic coverage only. AI-assisted. Codex (GPT-6, exact variant unavailable) extended the fixture, ran the tests, and drafted this report.Recheck after #2029 merged. I reran the same native RTX fixture on main at 1a0bbe3, then with each PR merged separately into that revision. Each run used the default streaming recheck setting and advanced no frames.
cargo test --offline --locked -p xcl --lib gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes -- --nocapture --test-threads=1passed with #1294. Main failed the pending-count assertion. #1733 failed the pixel assertion. Zero fixture skips. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the comparison and drafted this update.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:41:56Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:21:14Z.
Triage (#1607) – head
554cf14No open PR makes the same change: the 26 lines shared with #3099 come from that branch's stale base, and #3099 does not touch
recheck_source's PENDING accounting.The bug is still on main:
recheck_sourcebumpsPENDINGfor shadowed entries too, andTable::removereturns 0 for a shadowed entry and +1 when it is uncovered, so the count leaks or doubles. Main also restructuredrecheck_gpu_view_sourcessince, andmapping_changednow does the samePENDING.fetch_addfor a shadowed (!active) entry; the rebase has to cover that path too.The PR conflicts with main.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.