Tests: reserved-resource tiling parity with the host driver (issue #480) #2889
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2889"
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 Luislariosss on 2026-11-26T21:41:33Z.
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:d3d12x::vram::place_pages, which rewrites the layout toD3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLEand calls the realCreateReservedResource), obtaining the adopted consoleID3D12Devicefromd3d12x::D3D12XboxCreateDeviceafter checking the backend is Real;GetResourceTilingentry to return identical answers;GetDesc), which the page binding depends on;0xFFFFFFFFas its start tile (NVIDIA does this for a packed 8x8, and it is not a tile index): the packed range comes fromD3D12_PACKED_MIP_INFO, and that is what must fit;runner::skip_test) with no GPU, no tiled-resource support, no tier 2 heaps, or whenXCL_VRAM_ARENASdisables page placement.What is in it
crates/xcl/tests/tiling_parity.rs(new): thereserved_resource_tiling_matches_host_drivertest described above.Tested
stable-x86_64-pc-windows-msvc; debug build.cargo test -p xcl --test tiling_parity: ok, 1 passed, 0 failed, backendreal.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 aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1andfuzz_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 onmainon this adapter (tracked upstream in #2115).Not tested
AI use
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T21:57:22Z.
Update for head
f334cc9: passes on both cards now. Applied onmain8b957be,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 newBC5_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
ca3eb15applied onmain8b957be, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked withXCL_ADAPTER,XCL_VRAM_ARENASunset.cargo test -p xcl --test tiling_parity -- --nocapture:backend 'real' – AMD Radeon RX 9070 XT): ok, 1 passed.backend 'real' – NVIDIA GeForce RTX 3060): FAILED, 3 of 3 runs:The XCL-slot vs host-driver assert before it passes, so XCL hands back what the driver reports. With a local
eprintln!oft(not part of the PR), the two drivers describe the 8x8 case differently:So NVIDIA packs the single 8x8 mip and gives
start_tileas0xFFFFFFFF, andt.start_tile < t.total_tilesdoes 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.
Imported from ivall/xcl. Originally posted by akimfomin on 2026-11-26T21:57:48Z.
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 a0xffffffffsubresource start. In all three cases the packed-range start fromD3D12_PACKED_MIP_INFOwas 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.
Imported from ivall/xcl. Originally posted by Luislariosss on 2026-11-26T22:52:21Z.
Thanks both. The
0xFFFFFFFFsubresource start for a packed mip is a sentinel, not a tile index, and the assertion was wrong to read it as one. Head is nowf334cc9:StartTileIndexInOverallResource; the invariant now checks the packed range fromD3D12_PACKED_MIP_INFO(StartTileIndexInOverallResource+NumTilesForPackedMips <= pTotalTiles), which is 0 + 1 in the RTX 3060 report and fits;BC5_UNORM 512x512case 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_parityon the RTX 3060 atf334cc9, that would cover the one case I cannot run here.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T22:55:47Z.
@Luislariosss Reran at
f334cc9on the RTX 3060 (driver 32.0.16.1088):cargo test -p xcl --test tiling_paritypasses, 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 newBC5_UNORM 512x512all 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.
Imported from ivall/xcl. Originally posted by Luislariosss on 2026-11-26T23:00:59Z.
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).Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-26T23:21:52Z.
Intel Arc A770 capability check at
f334cc9344811525d814d63d0c39c6f2fe90a62eTested: 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 withcargo test --locked --release -p xcl --test tiling_parity --no-run, then ran the built test binary withreserved_resource_tiling_matches_host_driver --exact --nocapture --test-threads=1andXCL_ADAPTER=A770. The log confirms the real Intel backend and reportsSKIPPED 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.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:08:22Z.
Triage (#1607) – head
f334cc9#1786 (open, older) also checks
GetResourceTilingparity and the D3D12 tiling invariants for reserved textures, including one texture made throughvram::place. This PR is different: it goes throughvram::place_pagesfor five formats and asserts the64KB_UNDEFINED_SWIZZLElayout. The two overlap, but neither contains the other. On main,d3d12_create_reserved_resource.rsalready comparesGetResourceTilingwith the host for the hookedCreateReservedResource.Problem in
tiling_parity.rs: XCL does not hookGetResourceTiling(there is no override inhle/d3d12x). So the live vtable slot (orig_slot_fn) andreal::orig_fnare the same driver function, and assertion 1 ("XCL slot == host driver") compares the driver with itself. It cannot fail. What the test really checks is the layout and the invariants (steps 2-4), and the doc comment and test name should say that. The file also has no trailing newline.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.