Repository navigation
D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them - #470
Abdellah-Khanani wants to merge 2 commits into
Conversation
… 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>
|
Independent RDNA2 validation — AMD Radeon RX 6800 Confirmed that the packed-mip issue also affects RDNA2. Environment:
Results: Revision | Passed | Failed -- | -- | -- Main (2997c9a) | 0 | 2 PR #470 (3896e4f) | 4 | 0Main fails with: The PR passes the complete For the final A/B run, I temporarily instrumented the test to print and assert the actual DXGI adapter, since it uses Both runs confirmed 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. |
|
Test run of Tested
So on RDNA4, where Review of the change: Not tested: no retail title or regression run (I have no unpacked game), no Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Independent two-adapter validation of Tested
Not tested AI use |
|
Tested 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, Pass: 680 passed, 0 failed, 41 ignored. SKIPPED: only the 2
Run and written with Claude Code (Claude Opus 5.5). |
|
Fixes the 3D packed-mip failure on RDNA2 too: RX 6700S (Navi 22, driver 32.0.21045.29003), Windows 11 26200, debug,
Not tested: smoke.ps1 / retail title. Claude Code (Claude Opus 5.5) ran the tests and wrote this. |
|
Exact PR head Tested
Not tested
AI use
|
|
Tested on an RTX 5080: pass, the same counts as Several NVIDIA results are above already. This one adds an RTX 5080 on a release build, with a probe of the 3D texture's tile layout on this driver.
Not tested
AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2) |
|
Tested on Blackwell: the test this PR un-skips passes here. On With this PR @ Hardware: RTX 5070 Ti (Blackwell, 32-lane), driver 32.0.16.1742, Windows 11, 32 GB. Two observations from that run:
Not tested: one GPU, one driver. I cannot reproduce the RDNA1 case your description is based on. No smoke run — this change is in a test and |
|
One more thing after reading The premise deserves a second look. 2D arrays are skipped by the early return. |
|
Independent NVIDIA check on RTX 3060 12 GB, driver 610.88 (32.0.16.1088), Core i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc, debug. Tested:
I did not reproduce the AMD packed-mip readback failure on this NVIDIA adapter. The targeted test also stayed green with the extra mapping enabled. Not tested: full workspace, retail titles, or other adapters. AI use: OpenAI Codex (GPT-6) ran both local tests and summarized their output. |
Additional RDNA2 validation — RX 6700 XTConfirmed that the isolated VRAM mapping change from this PR resolves the packed-mip texture failure on my RX 6700 XT. Environment:
The original test failed at subresource 2 of the 64x64x64 3D texture, returning zeros. The other two failures passed independently and were associated with poisoned locks. Applying only the Limitations: Two tests counted as passed skipped their checks because the D3D12 debug layer was unavailable. No commercial game data was used. AI use: OpenAI Codex (GPT-6) assisted with compilation, investigation and local testing. |
|
@yyc160 Thanks, both are fair. I measured on the RX 5700 XT (RDNA1, 32.0.21045.29003), on 1. What the first call sends. For the 64x64x64 RGBA8 4-mip texture: That is 1+1+2+1+3+8+3 = 19 tiles, all mapped, no SKIP runs. Overall tile 18 (
So with identical heap tiles, this driver applies the linear region to tiles 0-17 but not to the packed block. NVIDIA (several cards above) and RDNA4 (MesshM's run) apply it, so it does depend on the driver. I could not find wording in the D3D12 docs that settles whether a linear 2. 2D arrays. Out of scope on purpose, because I can't test them here. With a temporary 2D |
|
Regression run on a retail title, as asked under Regression run. Tested
Regression run
this PR's head: Not tested
AI use
|
|
Tested
Not run: Report written with Claude Code (Claude Sonnet 5.5) from a real run on the hardware above. |
|
Tested - Tool: OpenCode with DeepSeek V4.1 Flash 1017
Tested - #470 + #673 together on AMD RDNA2
Not tested: retail title / AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report. |
|
Test report on RDNA2: this PR's head 3896e4f merged locally onto current Tested
So this PR also fixes the packed-mip readback on RDNA2, not only on the RX 5700 XT. Not tested
AI use
|
|
Test report on RDNA2 for this PR's head 3896e4f, merged locally onto current On RDNA2 the packed-mip test passes with this PR, so the fix is not specific to the RX 5700 XT. The title runs with it, with no crash and no device removal. The frame-rate comparison with main is within the noise of this machine. Tested
Regression run
Not tested
AI use
|
The title-texture and VRAM tests serialise on TEST_LOCK and VRAM_TEST_LOCK and took them with .lock().unwrap(). When one holder panics (on main, placed_title_textures_share_vram_and_preserve_pixels fails on RDNA2, the packed-mip case xcl-dev#470 fixes), the mutex is poisoned and every later test that takes it fails with PoisonError, though it passes alone: transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory. The locks guard no data, so take them the way the crate's other test locks already do (ASYNC_TEST_LOCK, READING_CB_TEST_LOCK): unwrap_or_else(|e| e.into_inner()). Test code only. Measured on an RX 6650 XT, cargo test --workspace -- --test-threads=4: lib tests 647 passed, 3 failed before; 649 passed, 1 failed after. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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:GetResourceTilinggives 19 tiles: mip 0 has 16 (start 0), mip 1 has 2 (start 16), and mips 2-3 are packed into 1 tile (NumStandardMips2, start 18). AfterPages::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_mipsincrates/xcl/src/hle/d3d12x/vram.rs, called aftermapinbind. 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 tilesmapchose, 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
cargo test --workspace --no-fail-fast -- --test-threads=4onmain2997c9a + this PR: 675 passed, 1 failed, 41 ignored. The failure isgpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction, which also fails onmainon this adapter and is unrelated (the driver does not fusemad; 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_pixelswith the test change but without thevram.rschange: fails (3D 64x64x64 4 mips: subresource 2 mismatch). With both changes: passes.Regression run
scripts/smoke.ps1 -Seconds 90, no input, second run of each (warm translation cache). The blocks are copied unchanged from that comment.main:this PR's head:
Not tested
AI use
GetResourceTilinglog, wrote both changes and this description, and ran the tests above on my machine. I reviewed the diff.🤖 Generated with Claude Code