Skip to content

D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them - #470

Open
Abdellah-Khanani wants to merge 2 commits into
ivall:mainfrom
Abdellah-Khanani:rdna1-packed-mips
Open

Abdellah-Khanani wants to merge 2 commits into
ivall:mainfrom
Abdellah-Khanani:rdna1-packed-mips

Conversation

@Abdellah-Khanani

Copy link
Copy Markdown

On AMD's RDNA1 Windows driver, the packed mips of a reserved title texture with standard mips stay unmapped, so they read zero. Measured on an RX 5700 XT with the 64x64x64 RGBA8, 4-mip 3D texture of placed_title_textures_share_vram_and_preserve_pixels: GetResourceTiling gives 19 tiles: mip 0 has 16 (start 0), mip 1 has 2 (start 16), and mips 2-3 are packed into 1 tile (NumStandardMips 2, start 18). After Pages::map's single run over the 19 overall tiles from subresource 0, mip 2 reads back all zero (3D 64x64x64 4 mips: subresource 2 mismatch). Mapping the packed block a second time, with the first packed mip as the subresource and the tile in the block as X (how D3D12 addresses packed mips), fixes it.

That test has been SKIPPED on this adapter since a6f5f7a, because the driver refuses the reserved 256x256x6 cube too. This PR lets the test run there: only the cube's same-address reuse step is left out when the cube is committed, so it catches this bug.

What is in it

  • D3D12.X: map the packed mips of a one-slice title texture where D3D12 addresses them: Pages::map_packed_mips in crates/xcl/src/hle/d3d12x/vram.rs, called after map in bind. Only for a 3D texture or a 2D texture without an array (an array keeps a packed block per slice; not measured here), and only when it has both standard and packed mips. It maps the same tiles map chose, so on a driver where the run already reached them nothing changes.
  • Tests: the title textures test runs on an adapter that makes no reserved cube: crates/xcl/src/hle/d3d12x/title_textures.rs. The whole-test skip from a6f5f7a is removed. The cubemap's same-address reuse check runs only when the first cube was reserved (a committed cube has no tiles to reuse); the existing tolerance for a committed cube stays as it was.

Tested

  • AMD Radeon RX 5700 XT (RDNA1, 8 GB), driver 32.0.21045.29003; Ryzen 5 2600; Windows 11 Pro 23H2 (22631); Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug.
  • Tiled resources tier 3, resource heap tier 2. The driver refuses the reserved 256x256x6 cube with 9 mips (committed instead).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on main 2997c9a + this PR: 675 passed, 1 failed, 41 ignored. The failure is gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction, which also fails on main on this adapter and is unrelated (the driver does not fuse mad; reported separately).
  • SKIPPED gpu::recomp::tests::gpu_geometry_mode_es_gs_strip: no mesh shaders, SKIPPED gpu::recomp::tests::gpu_mesh_mode_two_passes: no mesh shaders.
  • placed_title_textures_share_vram_and_preserve_pixels with the test change but without the vram.rs change: fails (3D 64x64x64 4 mips: subresource 2 mismatch). With both changes: passes.

Regression run

  • Not run. I have no retail title to run scripts/smoke.ps1 on, so this PR is a draft until someone with a title can run it, or the maintainer's batch run covers it.

Not tested

  • Any retail title (see above).
  • NVIDIA, Intel, AMD RDNA2-4, and GitHub's runner. On those, the second mapping covers tiles the first run already reached; I could not check that it changes nothing there, or that the test now passes on the runner.
  • Array and cube textures with packed mips, which this change leaves alone.

AI use

  • Claude Code with Claude Opus 5.5 (claude-opus-5-5): found the cause with a temporary GetResourceTiling log, wrote both changes and this description, and ran the tests above on my machine. I reviewed the diff.

🤖 Generated with Claude Code

Abdellah-Khanani and others added 2 commits November 24, 2026 01:45
… addresses them

On AMD's RDNA1 Windows driver (RX 5700 XT, 32.0.21045.29003) the packed mips
of a reserved title texture with standard mips stayed unmapped and read zero.
A 64x64x64 RGBA8 texture with 4 mips has 19 tiles there: mip 0 16, mip 1 2,
and mips 2-3 packed into one tile (NumStandardMips 2, start 18). After the
single run over the overall tiles from subresource 0 in Pages::map, mip 2
read back all zero.

The packed block is now mapped again with the first packed mip as the
subresource and the tile within the block as X, to the same tiles map chose.
Only for a 3D texture or a 2D texture without an array (an array keeps a
packed block per slice, not measured), and only when it has standard and
packed mips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ved cube

a6f5f7a skipped placed_title_textures_share_vram_and_preserve_pixels whole
on an adapter that refuses the reserved 256x256x6 cube with 9 mips, because
the cube's same-address reuse step then expected shared pages it never got.
That also hid the unmapped packed mips of the 3D texture on AMD's RDNA1
driver. The reuse step now runs only when the first cube was reserved (a
committed cube has no tiles to reuse); the rest of the test runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Mustafaiq1998x

Copy link
Copy Markdown

Independent RDNA2 validation — AMD Radeon RX 6800

Confirmed that the packed-mip issue also affects RDNA2.

Environment:

  • GPU: AMD Radeon RX 6800

  • Driver: 32.0.21045.29003

  • Windows build: 26300

  • Rust: 1.100.0 MSVC

  • DXC: 1.9.2602.17

  • Debug build

Results:

Revision | Passed | Failed -- | -- | -- Main (2997c9a) | 0 | 2 PR #470 (3896e4f) | 4 | 0

Main fails with:
3D 64x64x64 4 mips: subresource 2 mismatch

The PR passes the complete placed_title_textures_share_vram_and_preserve_pixels test.

For the final A/B run, I temporarily instrumented the test to print and assert the actual DXGI adapter, since it uses EnumAdapters1(0) rather than XCL_ADAPTER.

Both runs confirmed AMD Radeon RX 6800.

The diagnostic source changes were restored afterward. No retail game data was used.

This confirms the fix on RDNA2 in addition to the author's RDNA1 results.

AI use: ChatGPT (GPT-6.2) assisted with investigation, test planning and report preparation. All GPU tests were executed on my local hardware.

@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 3896e4fb97d4971971ab7b178a541170cb96318b on AMD RDNA4 (the PR has RDNA1 and RDNA2 results). The branch is based on 2997c9a, so I merged it onto current main 7ebf1b8 locally (clean merge, title_textures.rs and vram.rs) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4) on the merge: 677 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 637 passed, 0 failed, 21 ignored
  • 0 SKIPPED: on this adapter the reserved 256x256x6 cube is made, so placed_title_textures_share_vram_and_preserve_pixels takes the reserved path, including the cubemap same-address reuse step, with map_packed_mips active; it passes (again alone with --nocapture: 1 passed, 14.2 s, no SKIPPED line)

So on RDNA4, where map already reached the packed tiles before this change (the test ran and passed on main a6f5f7a on this machine, 0 SKIPPED), mapping them a second time changes nothing that the test can see.

Review of the change: map_packed_mips maps the same tiles map chose, addressed as D3D12 addresses packed mips (subresource = first packed mip, X = tile within the packed block), one call per heap with the other heaps' tiles skipped, as map does. It returns early for arrays and cubes, for textures without standard or packed mips, and when the packed block does not fit tiles. The test change keeps the reuse step only when the first cube was reserved, which is the case the step is about. I found nothing to change. One thing not measured: every placement of a one-slice texture with packed mips now does a second UpdateTileMappings and a Signal; that could matter during world streaming, next to #490.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main; main 7ebf1b8 itself was not run in full on this machine.

Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@WebIdentity1

Copy link
Copy Markdown

Independent two-adapter validation of 3896e4fb97d4971971ab7b178a541170cb96318b (base 2997c9a).

Tested

  • Ryzen 7 7800X3D / AMD Radeon(TM) Graphics (32.0.21030.2001) plus RTX 3090 (591.74), Windows10 build19045, Rust1.98.1 MSVC debug, SDK DXC1.8.2502.11, public Agility1.620.2.
  • The fixture ignores XCL_ADAPTER and picks adapter0 (AMD here). Focused A/B tests temporarily selected and asserted the adapter name/vendor on both sides; those diagnostics were removed for the full run.
  • Focused command: cargo test --locked -p xcl --lib hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels -- --exact --nocapture.
  • AMD integrated: PR test changes with base vram.rs fail at 3D64×64×64 mip2 (zero readback); full PR passes. RTX3090: original fixture skips for no reserved cubemap; PR test changes run and pass both with base mapping and PR mapping. Each completed focused run: 1 test, 0 ignored, 656 filtered out.
  • Exact head: cargo build --locked --workspace passes. Desktop session1, cargo test --locked --workspace --no-fail-fast -- --test-threads=1: 675 passed, 1 failed, 41 ignored. Remaining failure: pre-existing gpu_clamp_and_omod_per_instruction. Two native-wave64 SKIPPED tests, not GPU coverage: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • Four-thread full run did not complete: stopped after120s+ with UMA-init, two console-heap tests and copy_descriptors_remaps_xbox_extra_cbv_srv_uav_to_pc_enum waiting over60s. Root cause not established; related fixture-interference work exists in Tests: gpu_sparse_vram_descriptors_buffers_and_xmem fails beside the title-texture tests since #288 #343. Serial result is supplementary, not a claim of a clean four-thread run.

Not tested
Retail title/smoke, release, other GPUs. No XCL_SAMPLE_* data. Full-suite fixtures use mixed adapters; only the focused texture controls assert one GPU.

AI use
Codex (GPT-6) assisted with inspection, diagnostic overlays, test execution and this report. No changes proposed to the author's fix.

@PHeitor1

Copy link
Copy Markdown

Tested 3896e4f merged onto main 508a0c7.

RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*.

Pass: 680 passed, 0 failed, 41 ignored. SKIPPED: only the 2 no wave64 tests.

placed_title_textures_share_vram_and_preserve_pixels alone with --nocapture:

Run and written with Claude Code (Claude Opus 5.5).

@Y0z64

Y0z64 commented Nov 24, 2026

Copy link
Copy Markdown

Fixes the 3D packed-mip failure on RDNA2 too: RX 6700S (Navi 22, driver 32.0.21045.29003), Windows 11 26200, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*.

  • main a6f5f7a: 673 passed, 3 failed (placed_title_textures_share_vram_and_preserve_pixels + 2 follow-on), 41 ignored
  • this PR 3896e4f: 676 passed, 0 failed, 41 ignored, no SKIPPED

Not tested: smoke.ps1 / retail title. Claude Code (Claude Opus 5.5) ran the tests and wrote this.

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.

6 participants