Skip to content

Tests: reserved-resource tiling parity with the host driver (issue #480) - #2889

Open
Luislariosss wants to merge 1 commit into
xcl-dev:mainfrom
Luislariosss:test/tiling-parity
Open

Luislariosss wants to merge 1 commit into
xcl-dev:mainfrom
Luislariosss:test/tiling-parity

Conversation

@Luislariosss

@Luislariosss Luislariosss commented Nov 26, 2026 •

Copy link
Copy Markdown

Part of #480. Supersedes #712: the branch was force-pushed after that PR was closed, so GitHub cannot reopen it; this is the same change, reworked.

There is no test that checks XCL's D3D12 answers against the PC driver on the same machine, and for the part of the API plain D3D12 also implements the driver is ground truth: if the tiling XCL reports differs from what the driver would say, the title sees a difference no console-file test would catch.

New integration test crates/xcl/tests/tiling_parity.rs, no game data and no console DLL:

  • creates each texture through XCL's page-placement path (d3d12x::vram::place_pages, which rewrites the layout to D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE and calls the real CreateReservedResource), obtaining the adopted console ID3D12Device from d3d12x::D3D12XboxCreateDevice after checking the backend is Real;
  • on that same resource, requires XCL's device vtable slot and the driver's original GetResourceTiling entry to return identical answers;
  • requires the placed resource to still report the 64 KiB swizzle layout back (GetDesc), which the page binding depends on;
  • checks the invariants every D3D12 driver must satisfy, not one vendor's numbers: the standard-tile grid and the packed-mip tiles add up to the reported total, the standard grid and the packed-mip range each fit inside it, a mip is standard or packed, and the tile shape is the format's standard one (128x128x1 for 4-byte texel formats, 512x256x1 for BC1/BC4, 256x256x1 for BC5). The first round pinned the numbers measured on RDNA4 and failed on NVIDIA (a small texture is a 1x1 standard tile on AMD, a packed 0x0 grid on NVIDIA, per the test reports upthread); the driver-dependent grid is not pinned now, its accounting is, so the test holds on any vendor while still failing loudly on a broken layout rewrite or format mapping. A subresource in the packed mip tail reports 0xFFFFFFFF as its start tile (NVIDIA does this for a packed 8x8, and it is not a tile index): the packed range comes from D3D12_PACKED_MIP_INFO, and that is what must fit;
  • skips cleanly (runner::skip_test) with no GPU, no tiled-resource support, no tier 2 heaps, or when XCL_VRAM_ARENAS disables page placement.

What is in it

  • crates/xcl/tests/tiling_parity.rs (new): the reserved_resource_tiling_matches_host_driver test described above.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), Windows driver 32.0.32029.2010; Ryzen 5 9600X; Windows 11 build 26200; Rust 1.99.0 stable-x86_64-pc-windows-msvc; debug build.
  • cargo test -p xcl --test tiling_parity: ok, 1 passed, 0 failed, backend real.
  • NVIDIA GeForce RTX 3060 (driver 32.0.16.1088), at this head: ok, 1 passed, 0 failed, 4 of 4 runs, all cases including BC5_UNORM 512x512 (reported by @DarkPanda69 in the thread).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1316 passed, 2 failed, 27 ignored. The 2 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3 (a CPU/GPU result mismatch in the DXIL fuzzer): library tests this PR does not touch, and they fail the same way on main on this adapter (tracked upstream in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115).

Not tested

  • Intel GPUs.
  • The retail title.

AI use

  • Claude Code (Claude Sonnet 5.5) wrote the test, ran the commands above on the hardware named, and drafted this description.

@DarkPanda69

DarkPanda69 commented Nov 26, 2026 •

Copy link
Copy Markdown

Update for head f334cc9: passes on both cards now. Applied on main 8b957be, cargo test -p xcl --test tiling_parity -- --nocapture: RTX 3060 (backend 'real' – NVIDIA GeForce RTX 3060) 1 passed, 0 failed, 0 SKIPPED in 4 of 4 runs; RX 9070 XT (backend 'real' – AMD Radeon RX 9070 XT) 1 passed, 0 failed, 0 SKIPPED. So all cases, including the three that weren't reached before and the new BC5_UNORM 512x512, now pass on the RTX 3060.


NVIDIA run (listed as untested), with an RX 9070 XT in the same PC: the test passes on the AMD card and fails on the RTX 3060, 3 of 3 runs, on the first case.

Tested: head ca3eb15 applied on main 8b957be, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked with XCL_ADAPTER, XCL_VRAM_ARENAS unset.
cargo test -p xcl --test tiling_parity -- --nocapture:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010 (log: backend 'real' – AMD Radeon RX 9070 XT): ok, 1 passed.
  • NVIDIA RTX 3060, driver 32.0.16.1088 (log: backend 'real' – NVIDIA GeForce RTX 3060): FAILED, 3 of 3 runs:
panicked at crates\xcl\tests\tiling_parity.rs:278:17:
R8G8B8A8_UNORM 8x8: the packed mip tile is inside the resource

The XCL-slot vs host-driver assert before it passes, so XCL hands back what the driver reports. With a local eprintln! of t (not part of the PR), the two drivers describe the 8x8 case differently:

RX 9070 XT: R8G8B8A8_UNORM 8x8: Tiling { total_tiles: 1, grid: 1, start_tile: 0, standard_mips: 1, packed_mips: 0, .. }
RTX 3060:   R8G8B8A8_UNORM 8x8: Tiling { total_tiles: 1, grid: 0, start_tile: 4294967295, standard_mips: 0, packed_mips: 1, .. }

So NVIDIA packs the single 8x8 mip and gives start_tile as 0xFFFFFFFF, and t.start_tile < t.total_tiles does not hold there. Because this is the first case, the 256x256, BC1 and D32_FLOAT cases never run on the RTX 3060.

Not tested: the other three cases on NVIDIA (they don't get reached), Intel, release, the retail title.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@akimfomin

Copy link
Copy Markdown

I followed up on DarkPanda69's RTX 3060 result with a standalone native D3D12 probe on an RTX 4070 Ti SUPER (617.14, Windows build 28000). For this head (ca3eb1532c22cbfe1d51117c5032c159cdc0250f), it reads all four input descriptors without stopping at the first assertion. Besides RGBA8 8×8, both BC1 256×256 and D32 8×8 also returned one packed tile and a 0xffffffff subresource start. In all three cases the packed-range start from D3D12_PACKED_MIP_INFO was 0 and the count was 1. That range fits, while line 278 rejects the native sentinel. The RGBA8 256×256 case returned a standard 2×2 grid.

A separate format control from Wine's vkd3d tiling tests also ran on the same adapter. For single-mip 512×512 textures, BC1/BC4 returned 512×256 and two tiles, and BC5 returned 256×256 and four tiles. BC5 is a useful separate case if you extend the format matrix.

Seven standalone native checks passed. The probe also records all three rejections by the original packed-start assertion. DarkPanda69 ran the full XCL test. My run used the host API only. Source, build command and raw output

AI use: Codex (gpt-6.2-sol) read the sources, wrote and ran the standalone probe, and prepared this report.

@Luislariosss

Copy link
Copy Markdown
Author

Thanks both. The 0xFFFFFFFF subresource start for a packed mip is a sentinel, not a tile index, and the assertion was wrong to read it as one. Head is now f334cc9:

  • a packed subresource no longer asserts anything about its StartTileIndexInOverallResource; the invariant now checks the packed range from D3D12_PACKED_MIP_INFO (StartTileIndexInOverallResource + NumTilesForPackedMips <= pTotalTiles), which is 0 + 1 in the RTX 3060 report and fits;
  • added the BC5_UNORM 512x512 case with the standard 256x256x1 tile shape (4 tiles), per akimfomin's control run.

On AMD (RX 9060 XT, driver 32.0.32029.2010) the test still passes with the new case: 1 passed, 0 failed. @DarkPanda69 if you can rerun cargo test -p xcl --test tiling_parity on the RTX 3060 at f334cc9, that would cover the one case I cannot run here.

@DarkPanda69

Copy link
Copy Markdown

@Luislariosss Reran at f334cc9 on the RTX 3060 (driver 32.0.16.1088): cargo test -p xcl --test tiling_parity passes, 1 passed, 0 failed, 0 SKIPPED, 4 of 4 runs, and the log shows the 3060 as the adapter. So the packed 8x8 case, the three after it and the new BC5_UNORM 512x512 all pass there. The RX 9070 XT passes too. I added this to my comment above.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this reply.

@Luislariosss

Copy link
Copy Markdown
Author

Thanks @DarkPanda69 - with 4 of 4 on the RTX 3060 at f334cc9, the head is covered on both vendors now, so the description's Tested/Not tested sections are updated (Intel stays untested).

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…re messages)

Upstream xcl-dev#2890 (c6c14a1, single-commit on upstream/main 8b957be):
title_under_the_debug_layer prints the last TAIL=40 lines of xcl.log
in its three assertion messages and tolerates a missing log file
(unwrap_or_default), so a title that never finishes still shows why.

Verbatim port of the whole fix (1 file, +24/-4): the TAIL const +
tail() helper after the PathBuf import and the three rewritten
asserts. Applies cleanly; the only context offset is the
linux-only debug_layer_skip_line helper above the hunk.
Windows-only siblings xcl-dev#2888 (perf-compare ps1 stack), xcl-dev#2889
(tiling_parity.rs host-driver test, no cfg(windows) gate), xcl-dev#2891
(title_textures.rs write-watch tiering on the 71b8e6e dev-stack)
stay out per the step-139 sync entry.
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…m, pure std)

Upstream single-commit 7575f67 on 8b957be: 1 file shaders.rs +38/-2.
Helper + 2 direct_sweep call-site swaps + regression test, hunk bodies
identical (only line offset from linux-only helpers). xcl-dev#2909/xcl-dev#2910 SKIP
(hle/d3d12x/real.rs, Windows-only); xcl-dev#2906 SKIP (dev-stack tip, same
shape as xcl-dev#2886); xcl-dev#2889 re-pinned f334cc9 (force-push, still SKIP).
@JJAutoCompare

Copy link
Copy Markdown

Intel Arc A770 capability check at f334cc9344811525d814d63d0c39c6f2fe90a62e

Tested: Clean PR head, Windows 11 build 26200, Ryzen 7 3800X, Arc A770 16 GB, driver 32.0.101.9175, Rust 1.100.0 MSVC, release. Built with cargo test --locked --release -p xcl --test tiling_parity --no-run, then ran the built test binary with reserved_resource_tiling_matches_host_driver --exact --nocapture --test-threads=1 and XCL_ADAPTER=A770. The log confirms the real Intel backend and reports SKIPPED reserved_resource_tiling_matches_host_driver: no tier 2 resource heaps. Libtest counted 1 passed, 0 failed and 0 ignored, with that 1 capability skip.

Not tested: The reserved-texture tiling assertions did not execute on this Arc adapter.

AI use: T3 Code / Codex (gpt-6.2-sol) ran the test and wrote this report.

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