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

Manually merged
github merged 1 commit from gh-pr/1990/head into gh-pr/1990/base 2026-11-26 05:13:23 +00:00
Owner

@⁠Adika713 on GitHub · 2026-11-25 00:26 UTC · original
Adika713:fix/detile-3d-packed-mip-tails → main · +71 −1 · 2 files · 1 commits · merged 2026-11-25 01:24 UTC

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: https://github.com/xcl-dev/xcl/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.
**@⁠Adika713** on GitHub · 2026-11-25 00:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1990) `Adika713:fix/detile-3d-packed-mip-tails` → `main` · +71 −1 · 2 files · 1 commits · merged 2026-11-25 01:24 UTC 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: https://github.com/xcl-dev/xcl/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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:20 +00:00
github manually merged commit 971c0e5876 into gh-pr/1990/base 2026-11-26 05:13:23 +00:00
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:13 UTC · original

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.
**@⁠raylitebull** on GitHub · 2026-11-25 01:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1990#issuecomment-7149323973) 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`.
Author
Owner

@⁠Adika713 on GitHub · 2026-11-25 01:17 UTC · original

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.

**@⁠Adika713** on GitHub · 2026-11-25 01:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1990#issuecomment-7149390203) > 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.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 01:00 UTC · original · edited 2026-11-25 01:21 UTC

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 (#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.
**@⁠futurepro62** on GitHub · 2026-11-25 01:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/1990#issuecomment-7149118378) · edited 2026-11-25 01:21 UTC 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` (#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](https://git.gtahub.st/github/xcl-dev--xcl/issues/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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:33 UTC · original

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

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1990#issuecomment-7152023811) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.