D3D12.X: map and unmap 3D texture mips separately #1021
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1028"
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 bobosneefdev on 2026-11-24T10:33:27Z.
On RX 6800, one linear tile-mapping region leaves upper 3D mips reading zero, and a NULL update over the same region leaves them mapped. By the spec one region from subresource 0 covers every mip; this maps and unmaps 3D textures with one region per standard mip plus the packed tail instead. Requested follow-up to #470; independent of it.
Since #1990, 3D textures with an XG packed mip tail take the detile/upload path instead of
vram::Pages, so this applies to placed volumes whose mips all stay above the tail.What is in it
vram.rs:tile_regionsbuilds the regions fromGetResourceTiling, shared by map and unmap. 2D textures and unexpected tilings keepmain's single region, including its trailing-SKIPtrim from3bc7143; 3D textures with split regions skip that trim, since their regions must cover every tile.title_textures.rs: a 256×256×64 four-mip volume (no XG packed tail, so placed), and a check that every mip of a placed 3D texture reads zero after retirement.Tested
7a8b3a0196a7662668b50304373454658be2875b(onmain6987e49):cargo test --workspace --no-fail-fast -- --test-threads=4: 1153 passed, 1 failed, 46 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1; it fails the same way on cleanmainand does not touch this code.heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows); the per-lane cases off16_programs_on_the_gpuandf32_programs_on_the_gpu(refused by design).placed_title_textures_share_vram_and_preserve_pixelsonmain6987e49with this test but without thevram.rschange: fails with3D 256x256x64 4 mips: subresource 2 mismatch(2/2 runs); with it, passes.Regression run
scripts/smoke.ps1 -Game '<game folder>' -Seconds 60, release,XCL_DATA_ROOT=%TEMP%\xcl-mips-game-data,XCL_COHERENT_MB=512,XCL_FRAME_DUMP=300, no scripted input. Three alternating clean pairs on6987e49/7a8b3a0(main/head frames): 678/802, 872/810, 675/741; no removals or crashes, peak commit 16851–17578 MB on both. The blocks below are the first pair.Main (
6987e49):This head (
7a8b3a0):Not tested
XCL_SAMPLE_*inputs.AI use
gpt-6.1-sol): implementation, tests, first description.3bc7143and6987e49, the test update after #1990, description, full test runs, revert checks, smoke pairs and the mapping instrumentation.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by AlexandreSchuelter on 2026-11-24T11:15:19Z.
Test report on an RX 6900 XT (RDNA2): this PR fixes the
3D 64x64x64 4 mips: subresource 2 mismatchfailure, as-is and merged ontomain, and merges cleanly with #470.Tested
stable-x86_64-pc-windows-msvc, release;XCL_NETWORK=0,XCL_REQUIRE_GPU=wave64; no SKIPPED testscargo test -p xcl --lib --release -- --test-threads=4:placed_title_textures_share_vram_and_preserve_pixelsmain384f7f73D 64x64x64 4 mips: subresource 2 mismatch8e11e74384f7f73896e4f) merged onto384f7f7main(transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory) arePoisonErrorcascades: both pass when run without the failing test.main0/5 passed, this PR merged ontomain5/5 passed.Not tested
--workspace), only thexcllib testsscripts/smoke.ps1(no game here), debug builds, other GPUsAI use: Claude Code (Claude Opus 5.5) fetched the branches, ran the tests and wrote this report; the runs are real, on the hardware above.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T11:18:45Z.
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036 RDNA2) + RTX 3060 Ti; Rust stable MSVC, debug.
XCL_ADAPTER=radeon cargo test -p xcl --lib vram -- --test-threads=4: 8 passed, 1 failed —gpu_sparse_vram_descriptors_buffers_and_xmem(submit 1 lane 0 mismatch, left 0 / right 1077). That is the known #343 write-watch race between this test andplaced_title_textures_share_vram_and_preserve_pixels; the same pair fails identically on cleanmain384f7f7on this machine (3/3 + 1/1 runs), so it is not a regression here — on this iGPU the race resolves the same way every time.placed_title_textures_share_vram_and_preserve_pixelsitself passed on the Radeon — it carries this PR's new "unmapped subresource still reads data" asserts for 3D mip regions.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by RodrigoTorreao on 2026-11-24T12:40:00Z.
Test report on RDNA2 for
b3c53e9(head of this PR, unmodified).Tested
XCL_SAMPLE_RPF,XCL_SAMPLE_DLLS,XCL_SAMPLE_TTPF,XCL_SAMPLE_BVH4set to the retail title's filesmain47efa2e,cargo test --workspace --no-fail-fast -- --test-threads=4: 738 passed, 3 failed, 41 ignored, 0 SKIPPEDplaced_title_textures_share_vram_and_preserve_pixels:3D 64x64x64 4 mips: subresource 2 mismatch(mip 2 reads as zeros)transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memoryfail only withPoisonErrorafter it; each passes when run aloneb3c53e9,cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored, 0 SKIPPED;placed_title_textures_share_vram_and_preserve_pixelspasses, including the 3D subresource 2 caseNot tested
scripts/smoke.ps1run on the retail title, so this does not answer the frame-rate drop in the description (741 vs 1,004 frames)AI use
Imported from ivall/xcl. Originally posted by RodrigoTorreao on 2026-11-24T13:10:49Z.
Test report on RDNA2 for
b3c53e9, this PR's head, unmodified.The packed-mip test passes with this PR. Over repeated smoke runs I could not find the frame-rate drop from the description. The spread between runs of the same build is larger than any difference between builds, so this setup can neither confirm nor rule it out.
Tested
XCL_SAMPLE_RPF/DLLS/TTPF/BVH4set to the retail title's files,cargo test --workspace --no-fail-fast -- --test-threads=4.main47efa2e: 738 passed, 3 failed, 41 ignored, 0 SKIPPED.placed_title_textures_share_vram_and_preserve_pixels:3D 64x64x64 4 mips: subresource 2 mismatch. Mip 2 reads as zeros.PoisonErrorfollow-ons. Each passes when run alone.cargo build --workspace: 741 passed, 0 failed, 41 ignored, 0 SKIPPED.scripts/smoke.ps1 -Seconds 60on the retail title, DXC 1.9.2609 viaXCL_DXC_DIR, warm DXIL cache.pressed, andkeyboard_mouse = falsewas set for the interleaved rounds.Regression run
Frames shown in 60 s, all clean runs. The last three columns are interleaved rounds, in the order main → #470 → this PR.
47efa2eb3c53e9xcl-smokeblocks and logs and can paste any of them.Not tested
GetDeviceand aGetResourceTilingper map/unmap of a 3D texture, and one region per mip. I did not profile it.AI use
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T14:22:34Z.
A regression run under Wine on Linux, on a retail title.
Tested
x86_64-pc-windows-gnu.b3c53e9as it is (merge base47efa2e) andmain47efa2e, no uncommitted changes. Retail title 1.0.2.1,scripts/linux/smoke.sh(#257) for 60 s, no input. Twelve runs in a row,mainfirst and last, other PRs in between.title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels(--exact, one process each, lib test binary under Wine): 3 of 3 passed on this PR (its new3D 128x128x128 5 mipscase included) and 3 of 3 onmain47efa2e. vkd3d-proton implements the tile mappings itself, not an AMD driver. I did not check whether the 3D shapes were placed as tiled resources here (the tier 3 branch) or fell back to committed ones, so this does not show the RX 6800 fault or its fix on this stack.Regression run
main (first run):
this PR:
The last
mainrun: 1425 frames,exit: 0x0, no device removal, no crash. Under Wine,peak commitreads 0 MB, so these blocks do not check memory.Not tested
AI use
Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-24T15:00:01Z.
Tested commit
b3c53e98de18b2150b361303010f702ba3610f31on an AMD RX 6600 (RDNA2) wheremain(930e8b4) failsplaced_title_textures_share_vram_and_preserve_pixelswith3D 64x64x64 4 mips: subresource 2 mismatch(plus 2 cascadingPoisonErrorfailures). This PR fixes it and passes the new3D 128x128x128 5 mipsand post-retirement unmap checks.Tested
XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust 1.100.0 (stable-x86_64-pc-windows-msvc, debug), DXC 1.8.2502.11.XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 736 passed, 0 failed, 41 ignored (xcl --lib: 698 passed, 0 failed, 21 ignored; integration tests: 38 passed, 0 failed, 20 ignored).SKIPPED(2 tests, not coverage):test_title_draws_with_a_root_signature_under_the_debug_layer:no d3d12SDKLayers.dlluploads_start_from_each_subresources_state:no D3D12 debug layer (0x887A002D)Not tested
d3d12SDKLayers.dllnot installed) and systemxgameruntime.dll.scripts/smoke.ps1) — no game executable available here.XCL_SAMPLE_*tests on this commit, other GPUs / drivers (RDNA1/3/4, NVIDIA, Intel).AI use
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:33:32Z.
Empirical test report (
325f864c)PR #1028 was checked at
325f864cab487b2f8d7831d2bbca977a06ad81a2in a clean, detached worktree.Hardware / environment
32.0.101.9175. A separate D3D12 capability query on adapter 0 returned Tiled Resources Tier 4 and Resource Heap Tier 1.1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5 (01b62ad47). Unoptimized Cargo test profile with debug info and incremental compilation disabled.Commands and results
cargo test --workspace --no-runcompleted outside the Arc lock (exit 0).Invoke-ArcTest.ps1, ran onlyxcl-77aca8ccb20e299f.exe --exact hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelswithXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1(exit 0). The fixture selects DXGI adapter 0 directly.SKIPPEDmarker, leaving 0 completed fixture bodies.Observed behavior
SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2. That branch also checks Resource Heap Tier 2. The Arc adapter's Resource Heap Tier 1 fails the check before any texture placement, mip readback, or retirement assertions.Not tested
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1028-focused.logand published.Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T15:22:03Z.
Paired native D3D12 result on the RTX 4080 for the current #1028 head. Both revisions passed the same four-mip volume test.
6987e496c35653f9ccc9dbdc1f1d3427343068117a8b3a0196a7662668b50304373454658be2875bBoth used a reserved 256×256×64 RGBA8 volume. DXGI verified the physical RTX 4080, Tiled Resources Tier 4, three standard mips, one packed mip, and 293 tiles. The four readbacks matched all 19,169,280 uploaded bytes. After retirement and a queue drain, every mip read back as zero.
Tested on NVIDIA RTX 4080 driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974 and Rust 1.100.0 x64 MSVC debug. Separate binaries built with
cargo test --offline --locked -j 4 -p xcl --lib --no-run --message-format=json. Each ranhle::d3d12x::title_textures::tests::pr1028_placed_volume_reads_all_mips_before_and_after_retirement --exact --test-threads=1 --nocapturewithXCL_ADAPTER=4080.Not tested were a retail title, an AMD adapter, or performance.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:34:47Z.
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-01T04:40:29Z.
Triage (#1607) – head
7a8b3a0#470 also works on tile mappings that miss later mips on AMD drivers, but in a different way. It maps the packed block of a one-slice texture a second time, addressed from its first packed mip, and only when mapping. This PR gives a 3D texture one region per standard mip plus one for the packed block, for both map and unmap. Each fixes a case the other does not, so this is not a duplicate. The approach is not on main:
Pages::map/unmap_rangestill use one linear region fromsub.The PR conflicts with main.
mapnow takes asub(lazy levels), and since #1990 3D textures with an XG packed tail take the detile path, sotile_regionsneeds a rebase. Its regions start at subresource 0, which is only right whilesubis 0.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.