Skip to content

D3D12.X: prevent stale texture unmaps after placement restoration - #2065

Draft
Mustafaiq1998x wants to merge 1 commit into
xcl-dev:mainfrom
Mustafaiq1998x:fix/stale-texture-unmap
Draft

Mustafaiq1998x wants to merge 1 commit into
xcl-dev:mainfrom
Mustafaiq1998x:fix/stale-texture-unmap

Conversation

@Mustafaiq1998x

@Mustafaiq1998x Mustafaiq1998x commented Nov 25, 2026 •

Copy link
Copy Markdown

Addresses point 2 of #1897.

A delayed unmap can remove VRAM mappings from a texture that has already been restored to the active placement table. This fix revalidates mapping decisions under the texture table lock.

What is in it

  • Prevent stale unmaps of restored textures.
  • Prevent obsolete remaps of superseded placements.
  • Add a deterministic GPU regression test with pixel readback and normal unmap/remap controls.

Tested

  • AMD Radeon RX 6800 16 GB, driver 32.0.21045.29003.
  • Intel Core i5-13400, 16 GB RAM.
  • Windows build 26300, Rust 1.100.0, DXC 1.9.2602.17.
  • Base: cbc296a
  • Head: 3ff9893

Before:

STALE_UNMAP_RESULT active=true mapped=false
RED_EXIT=101

After (three consecutive successful GPU runs):

STALE_UNMAP_RESULT active=true mapped=true
STALE_UNMAP_CONTROL unmap=true remap=true pixels=true
STALE_UNMAP_PIXELS_PASS
GREEN_CONFIRMED
  • Existing overlapping-placement and shared-VRAM tests passed.
  • Debug workspace and release builds passed.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture: 1154 passed, 1 failed, 46 ignored.
  • The failing DXIL fuzz test also fails on the clean baseline. Exact baseline seed equality is not verified.
  • GPU skips include unsupported per-lane configurations, unavailable driver-cache control, debug layers and heap windows.

Regression run

Pending paired real-title smoke tests.

Not tested

AI use

ChatGPT (GPT-6.2) assisted with implementation, source analysis and regression-test design. All reported GPU tests were executed on physical hardware.

Fixes point 2 of xcl-dev#1897. Revalidate delayed mapping decisions under TEXTURES. A deterministic RX 6800 regression reproduced an active but unmapped texture before the fix. Three post-fix runs preserve mappings and pixel data, including ordinary unmap/remap controls.
@WebIdentity1

WebIdentity1 commented Nov 25, 2026 •

Copy link
Copy Markdown

Independent RTX 3090 check of exact 3ff98937f3bb94820b23b582355920c0396a6225: the deterministic stale-unmap regression reproduces without the state checks and passes with your unchanged fix.

Tested — Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 (32.0.15.9174), Rust/Cargo 1.98.1 x64 MSVC, DXC 1.8.2502.11, debug, XCL_ADAPTER=3090.

cargo test --locked -p xcl --lib -- stale_unmap_after_texture_restoration overlapping_placements_retire_superseded_entries placed_title_textures_share_vram_and_preserve_pixels --test-threads=1 --show-output
Snapshot Passed / failed / ignored Explicit skips Restored texture
Head with only the two mapping helpers restored to unconditional unmap/remap 2 / 1 / 0 1 active=true mapped=false
Unmodified head 3 / 0 / 0 1 active=true mapped=true

The negative control is the same head with identical author tests, not a parent checkout. The focused test prints NVIDIA GeForce RTX 3090. Positive initial/restored/control texture-copy readbacks all match the expected contents, and STALE_UNMAP_CONTROL unmap=true remap=true pixels=true / STALE_UNMAP_PIXELS_PASS are present. The negative test stops before reading the known-unmapped texture. The placement-table unit control passes both.

The explicit skip in each run is placed_title_textures_share_vram_and_preserve_pixels: this adapter makes no reserved cube with mips. It returns before its streaming/pixel controls, so those are not coverage. That existing test uses EnumAdapters1(0), not the XCL_ADAPTER selector; I cannot attribute its skip to the 3090 from its log. The new stale-unmap test selects and names the 3090 correctly.

Both 322-file source manifests match before/after on Windows and locally; Cargo rebuilt XCL for both snapshots. No additional runtime change or competing PR.

Not tested — full workspace suite, retail smoke/world entry, performance, the reversed stale-remap interleaving independently, or the separate submitted-GPU-work/cross-queue lifetime hazards in #1897 point 1 / #594 / #799. This fills the NVIDIA gap for the deterministic restoration/unmap case; it is not a merge-readiness or gameplay claim.

AI use — Codex (GPT-6) reviewed the change, prepared the control, ran and verified the native comparison, and wrote this report. The runtime fix and regression are the PR author's.

@Mustafaiq1998x

Copy link
Copy Markdown
Author

Independent RTX 3090 check of exact 3ff98937f3bb94820b23b582355920c0396a6225: the deterministic stale-unmap regression reproduces without the state checks and passes with your unchanged fix.

Tested — Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 (32.0.15.9174), Rust/Cargo 1.98.1 x64 MSVC, DXC 1.8.2502.11, debug, XCL_ADAPTER=3090.

cargo test --locked -p xcl --lib -- stale_unmap_after_texture_restoration overlapping_placements_retire_superseded_entries placed_title_textures_share_vram_and_preserve_pixels --test-threads=1 --show-output

Snapshot Passed / failed / ignored Explicit skips Restored texture
Head with only the two mapping helpers restored to unconditional unmap/remap 2 / 1 / 0 1 active=true mapped=false
Unmodified head 3 / 0 / 0 1 active=true mapped=true
The negative control is the same head with identical author tests, not a parent checkout. The focused test prints NVIDIA GeForce RTX 3090. Positive initial/restored/control texture-copy readbacks all match the expected contents, and STALE_UNMAP_CONTROL unmap=true remap=true pixels=true / STALE_UNMAP_PIXELS_PASS are present. The negative test stops before reading the known-unmapped texture. The placement-table unit control passes both.

The explicit skip in each run is placed_title_textures_share_vram_and_preserve_pixels: this adapter makes no reserved cube with mips. It returns before its streaming/pixel controls, so those are not coverage. That existing test uses EnumAdapters1(0), not the XCL_ADAPTER selector; I cannot attribute its skip to the 3090 from its log. The new stale-unmap test selects and names the 3090 correctly.

Both 322-file source manifests match before/after on Windows and locally; Cargo rebuilt XCL for both snapshots. No additional runtime change or competing PR.

Not tested — full workspace suite, retail smoke/world entry, performance, the reversed stale-remap interleaving independently, or the separate submitted-GPU-work/cross-queue lifetime hazards in #1897 point 1 / #594 / #799. This fills the NVIDIA gap for the deterministic restoration/unmap case; it is not a merge-readiness or gameplay claim.

AI use — Codex (GPT-6) reviewed the change, prepared the control, ran and verified the native comparison, and wrote this report. The runtime fix and regression are the PR author's.

Thank you for independently reproducing and verifying the fix on the RTX 3090.

Would you also be able to perform the required paired retail-title smoke tests on main and commit 3ff9893?

I currently don't have a compatible unpacked retail title available. Your assistance would help satisfy the remaining PR regression requirement.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants