Skip to content

D3D12.X: detile 3D textures with packed mip tails - #1990

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
Adika713:fix/detile-3d-packed-mip-tails
Nov 25, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
Adika713:fix/detile-3d-packed-mip-tails

Conversation

@Adika713

@Adika713 Adika713 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1488.

On Tier 2 adapters, 3D title textures with an XG packed mip tail were placed on shared vram::Pages. XG packs volume tails differently from the D3D12 driver, so mips after the first packed tail were read back with the wrong bytes (placed_title_textures_share_vram_and_preserve_pixels: "3D 64x64x64 4 mips: subresource 2 mismatch"). place_pages now falls back to the committed detile/upload path only for 3D XG textures whose first packed mip precedes the last level; other resources keep the shared-page path. The GPU test checks both placement policy and volume pixels.

Compare: main...Adika713:fix/detile-3d-packed-mip-tails

What is in it

  • crates/xcl/src/hle/d3d12x/vram.rs: short-circuit place_pages for 3D textures with a packed XG mip tail, add the layout check, and cover packed 3D, single-mip 3D and packed 2D descriptors in a unit test.
  • crates/xcl/src/hle/d3d12x/title_textures.rs: require the committed detile/upload path for packed 3D textures and keep verifying their volume pixels.

Tested

  • Windows 11 x64; AMD Radeon RX 6950 XT (driver 32.0.21045.29003), AMD Ryzen 5 3600; Rust 1.100.0 MSVC; debug tests, release smoke.
  • cargo check -p xcl --locked: passed in 26.99 s (two pre-existing Atomic::fetch_update deprecation warnings).
  • cargo test -p xcl --lib hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib hle::d3d12x::vram::tests::packed_console_3d_mip_tails_use_the_detile_upload_path -- --exact --test-threads=1: 1 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib --no-fail-fast -- --test-threads=4: 810 passed, 0 failed, 22 ignored.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4 on head 971c0e5: all targets passed; e2e 3 passed, 0 failed; xg_oracle 6 passed, 12 ignored. SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.
  • git diff --check: clean.
  • Real-title regression pair below: same game folder, 60 s, RX 6950 XT. Both exited 0x0 with no device removals or crashes; PR head 445 frames against main's 444, peak commit 16560 MB against 16498 MB.

Regression run

  • main (f5136a640a69be3ce072e1ea8939e97d005b4cb1, a commit of main):
xcl-smoke v1
commit: f5136a640a69be3ce072e1ea8939e97d005b4cb1
gpu: AMD Radeon RX 6950 XT
title: retailgame-smoke-copy
seconds: 60
exit: 0x0
frames shown: 444 (PresentX 444)
presents per 2 s (last 3): 17 36 36
device removals: 0
crashes: 0
peak commit: 16498 MB
  • PR head (971c0e58765ef01e353722075af95bc658021e2a, clean worktree):
xcl-smoke v1
commit: 971c0e58765ef01e353722075af95bc658021e2a
gpu: AMD Radeon RX 6950 XT
title: retailgame-smoke-copy
seconds: 60
exit: 0x0
frames shown: 445 (PresentX 445)
presents per 2 s (last 3): 35 34 37
device removals: 0
crashes: 0
peak commit: 16560 MB

Both runs used the same game folder and label produced by scripts/smoke.ps1 at the PR head; the main script's hash label was normalized to that folder label, with no measured field changed.

Not tested

  • NVIDIA adapters (packed-tail layouts are driver-specific), real-time DXR traversal, and gameplay beyond this 60 s smoke run. Tests and smoke were run at head 971c0e5; upstream main advanced afterwards and this branch was not rebased for the handoff.

AI use

  • OpenCode with Big Pickle (opencode/big-pickle): root-cause analysis, implementation, regression test, description and the command runs above. A human must open the PR under CONTRIBUTING.md.

XG and PC D3D12 drivers pack 3D mip tails differently. Do not map XG packed volume tails directly onto the driver-defined packed tail; use the existing committed-resource detile/upload path. Cover packed and unpacked 3D placement policy and verify volume pixels on GPU.
@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 971c0e5 (on its base c160d86).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 858 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: packed_console_3d_mip_tails_use_the_detile_upload_path.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 859 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@raylitebull

Copy link
Copy Markdown
Member

Code review on 971c0e5:

  • Packed mip tail handling for 3D texture detiling in title_textures.rs / vram.rs is well-scoped, and the RTX 5070 Ti suite passes.
  • Diff audited and CI workflow approved (currently running).

Remaining before merge:

  1. Fix the failing PR description check.
  2. Confirm Build and test (Windows, no GPU) finishes green.
  3. An AMD verification pass on 971c0e5.

@Adika713

Copy link
Copy Markdown
Contributor Author

Code review on 971c0e5:

  • Packed mip tail handling for 3D texture detiling in title_textures.rs / vram.rs is well-scoped, and the RTX 5070 Ti suite passes.
  • Diff audited and CI workflow approved (currently running).

Remaining before merge:

  1. Fix the failing PR description check.
  2. Confirm Build and test (Windows, no GPU) finishes green.
  3. An AMD verification pass on 971c0e5.

Thanks for the review. For item 3, here is an AMD verification pass on the exact PR head 971c0e58765ef01e353722075af95bc658021e2a:

  • Windows 11 x64; AMD Radeon RX 6950 XT (driver 32.0.21045.29003), AMD Ryzen 5 3600; Rust 1.100.0 MSVC; tests in debug, title smoke in release.
  • cargo test -p xcl --lib hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib hle::d3d12x::vram::tests::packed_console_3d_mip_tails_use_the_detile_upload_path -- --exact --test-threads=1: 1 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib --no-fail-fast -- --test-threads=4: 810 passed, 0 failed, 22 ignored.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: all targets passed; xcl lib 810 passed, 0 failed, 22 ignored; e2e 3 passed, 0 failed; xg_oracle 6 passed, 12 ignored. SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.
  • cargo check -p xcl --locked: passed (two pre-existing Atomic::fetch_update deprecation warnings). git diff --check: clean.
  • Release title smoke on the PR head, same game folder as the main comparison, 60 s: exit 0x0, 445 frames shown, 0 device removals, 0 crashes. The main comparison (f5136a640a69be3ce072e1ea8939e97d005b4cb1) exited 0x0 with 444 frames, 0 removals, 0 crashes.

This complements the RTX 5070 Ti full-suite report above. Items 1 and 2 remain with the PR author.

AI use: OpenCode with Big Pickle (opencode/big-pickle) read the full PR thread and the saved AMD test/smoke logs and prepared this draft; nothing was posted.

@raylitebull
raylitebull merged commit 8f5fca5 into xcl-dev:main Nov 25, 2026
2 of 5 checks passed
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

bobosneefdev added a commit to bobosneefdev/xcl that referenced this pull request Nov 25, 2026
By the spec, one linear UpdateTileMappings region from subresource 0
covers every mip of a reserved texture. On RX 6800 (32.0.21045) it
leaves upper 3D mips unmapped, and a NULL update over it leaves them
mapped. Build one region per standard mip plus the packed tail from
GetResourceTiling for both operations; 2D textures and unexpected
tilings keep the linear region.

Since xcl-dev#1990, 3D textures with an XG packed mip tail take the
detile/upload path instead, so this applies to volumes whose mips all
stay above the tail. The texture-placement GPU test gains such a
volume (256x256x64, four mips) and checks that every mip of a placed
3D texture reads zero after retirement. It fails at mip 2 without this
change.

Assisted-by: T3 Code through Codex (gpt-6.1-sol)
Assisted-by: Claude Code (Claude Opus 5.5)
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.

4 participants