Tests: compare CreateReservedResource against the host D3D12 driver #612
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/617"
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 towiice on 2026-11-24T02:33:19Z.
Adds host-driver parity integration tests for
ID3D12Device::CreateReservedResource(vtable slot 30) with no console files or game data. Part of #480.Captures the unhooked PC driver's
CreateReservedResourcefunction pointer befored3d12x::backend()hooks the singleton device's vtable in place, verifies the slot was hooked, and compares XCL's hooked path directly against the raw host driver on the same adapter.What is in it
crates/xcl/tests/d3d12_create_reserved_resource.rs:pc_reserved_resources_match_host_driver: comparesHRESULT,GetDesc(), andGetResourceTiling()(total_tiles,packed_mip_info,tile_shape,subresource_tiling[0]) against the unhooked host driver across valid buffers (64 KiB,256 KiB), 2D textures (8x8RGBA8,256x256RGBA8 with 4 mips,128x128BC7), a 3D volume texture (64x64x64RGBA8), and invalid descriptors (Width = 0buffer,ROW_MAJOR2D texture). Comparing directly against the host driver'sGetResourceTilingworks on both AMD standard-tile and NVIDIA packed-mip-tail drivers.unknown_console_iid_falls_back_to_pc_resource_interface: verifies the unhooked host driver returnsE_NOINTERFACEfor an unknown console IID while XCL retries withIID_ID3D12Resourceand returns a usable resource.reserved_resource_clear_value_and_null_ppv_match_host: compares a render-target reserved texture withD3D12_CLEAR_VALUEand appv == nullcall against the host driver.Tested
stable-x86_64-pc-windows-gnullvm, llvm-mingw 23.1.6 UCRT), DXCv1.9.2609, debug build (cargo build --workspace).cargo test -p xcl --test d3d12_create_reserved_resource -- --test-threads=4: 3 passed, 0 failed, 0 ignored (1.09 s).eba5e09(same tree as5497e00, basecb868b2), same GPU (driver 32.0.16.1088), Rust 1.100.0x86_64-pc-windows-gnullvm, debug, run with Claude Code:cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 685 passed, 3 failed, 41 ignored. Failed:placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory(xcllib, which this PR does not touch;mainwas not rerun this time). SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware. The 3 new tests passed.Not tested
stable-x86_64-pc-windows-gnullvm).crates/xcl/tests/, no runtime files touched).AI use
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-24T03:03:01Z.
Tested
60f232c6f98a799882cd20b19bd9ca40596cbba7on NVIDIA GeForce RTX 4080, driver 621.01, Intel Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug.XCL_ADAPTER=4080,XCL_REQUIRE_GPU=1, allXCL_SAMPLE_*variables unset. The XCL backend logged the RTX 4080.cargo test -p xcl --test d3d12_create_reserved_resource --locked -j 4 --no-run --message-format=jsonand ran the resulting executable with--test-threads=1 --show-output. The clean head passed 3/3 with zero skips.ID3D12Devicefor both creation paths. It asserted the pointer equaledreal::device_raw()before obtaining the original slot withreal::orig_fn(xcl_raw, CREATE_RESERVED_RESOURCE_SLOT). The raw driver slot and hooked slot were distinct. Both creation paths and both tiling queries used that device. This run also passed 3/3 with zero skips, including the small RGBA8 texture and the packed-mip comparison. The fixture logged the RTX 4080 as LUID00000000:0000f0ad.Using the original slot on the adopted backend device makes the comparison same-adapter by construction and removes the extra default-device creation.
orig_fnrequires an adopted object, so the pointer check is useful to retain.Not tested
AI use
Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T03:08:44Z.
Thanks @caua-an and @CryingLaughing for catching the multi-GPU adapter mismatch and testing the fix! Updated in
c2edeb6to use the adopted backend device (real::device_raw()) withreal::orig_fn(xcl_raw, 30)for both paths so host and XCL always run on the same adapter even withXCL_ADAPTERset. Re-tested on NVIDIA GeForce GTX 1650 SUPER (cargo test -p xcl --test d3d12_create_reserved_resource -- --test-threads=1): 3 passed, 0 failed (0.91 s).Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T03:44:21Z.
Thanks @pvfreis! Updated in
ef39c26to route skips throughxcl::gpu::recomp::runner::skip_test("no GPU")so stderr skip counting andXCL_REQUIRE_GPUassertions work as expected.Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T03:50:35Z.
Test report: #617 under Wine with vkd3d-proton as the host driver (Linux, NVIDIA)
The other runs here are native Windows drivers. Under Wine, the host driver this test compares XCL with is vkd3d-proton (D3D12 on Vulkan), and the test passes there as well.
Setup
experimental-11.0-20261112(wine-11.0), vkd3d-proton v3.1 (4522cc1a) + the patch from #257, DXVK from Proton,DXVK_CONFIG="dxgi.hideNvidiaGpu = False"x86_64-pc-windows-gnu(mingw-w64-gcc 16.2.0), debug build of this PR's headef39c26Result:
d3d12_create_reserved_resourcetest binary under Wine,--test-threads=1: 3 passed, 0 failed, 0 ignored, in 2 of 2 runs (and 3 passed on the earlier headc2edeb6).pc_reserved_resources_match_host_driver,reserved_resource_clear_value_and_null_ppv_match_host,unknown_console_iid_falls_back_to_pc_resource_interface: okNot tested
AI use: Claude Code (Claude Opus 5.5) built the test, ran it on the machine above and wrote this report. The results are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.
Imported from ivall/xcl. Originally posted by caua-an on 2026-11-24T02:47:23Z.
Tested: Clean head
60f232c6f98a799882cd20b19bd9ca40596cbba7; Windows 11 Home build 26200, Core Ultra 9 185H, Rust 1.100.0 MSVC x64, debug build,XCL_REQUIRE_GPU=1. Intel Arc integrated graphics driver 32.0.101.8860; RTX 4070 Laptop driver 616.92.cargo test --offline --locked -p xcl --test d3d12_create_reserved_resource -- --test-threads=1 --nocapture: 3 passed on Intel Arc (XCL_ADAPTER=intel); 2 passed, 1 failed on the RTX 4070 Laptop (XCL_ADAPTER=nvidia), with no skips. The NVIDIA run failed ontex2d_8x8_rgba8atpacked_mip_info. A separate diagnostic run with a temporary LUID check confirmed that the default host device and the XCL device were on different adapters withXCL_ADAPTER=nvidia, and on the same adapter withXCL_ADAPTER=intel. This does not establish a same-adapter NVIDIA mismatch. Suggest selecting the same adapter explicitly for both devices and asserting matching LUIDs before comparing layouts. The diagnostic edit was removed.Not tested: Full workspace suite, release builds, retail titles, or game-data samples (
XCL_SAMPLE_*unset).AI use: OpenCode with GPT-6.2 Sol ran the tests and drafted this report.
Follow-up: nonzero subresource range. I tried a small test-only extension locally on
ef39c26179c4ff32a862b07b24c875b513537f0d. It reuses the 256x256 RGBA8 reserved texture with four mips, asksGetResourceTilingfor two entries starting at subresource 1, and checks that both paths return two entries and that the layouts match. No adapter-specific tile counts are assumed.With the local extension applied,
cargo test --offline --locked -p xcl --test d3d12_create_reserved_resource -- --test-threads=1 --nocapturereported 3 passed, 0 failed, 0 ignored, no skips on each GPU (RTX 4070 Laptop and Intel Arc, same setup andXCL_REQUIRE_GPU=1as above). No full suite or game data was tested. Happy to share the small diff if you would like to include this case in #617.AI use (follow-up): OpenCode with GPT-6.2 Sol wrote the local test extension, ran the tests, and drafted this update.
Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T03:34:41Z.
Test report for
5497e0085b(this PR's head, with theGetResourceTilingrange check from subresource 1), merged onto main930e8b49c1(clean merge). The three tests ind3d12_create_reserved_resource.rspass on NVIDIA; no regression elsewhere. (This comment first coveredc2edeb6, thenef39c26; updated for the new head.)Tested
cargo build --workspace --locked --offline, thencargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4:930e8b4: 750 passed, 1 failed, 41 ignored930e8b4: 753 passed, 1 failed, 41 ignored. The difference is the 3 tests ind3d12_create_reserved_resource.rs, all passing on the real backend:pc_reserved_resources_match_host_driver(which now includes the range check),reserved_resource_clear_value_and_null_ppv_match_host,unknown_console_iid_falls_back_to_pc_resource_interfacegpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64). The new tests did not skip.test_title_runs_and_game_folder_is_untouched(e2e,presents0), because these runs are in an isolated non-interactive session whereCreateSwapChainForHwndreturns 0x887A0022.Not tested
XCL_REQUIRE_GPUset (these runs had it unset)Tested and written with Claude Code (Claude Opus 5.5); the runs are real, on the hardware above.
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T04:54:03Z.
Test run of
ef39c26179c4ff32a862b07b24c875b513537f0don AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 704 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 660 passed, 0 failed, 21 ignoredSKIPPED; thed3d12_create_reserved_resourcetests pass on a single-adapter machine, with skips routed throughskip_test.Review: This adds an AMD RDNA4 data point to the NVIDIA, Intel and Wine/vkd3d runs above. Test-only. I found nothing to change.
Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T11:41:49Z.
Thanks @caua-an! Added in commit
5497e00: whenMipLevels > 1, the test now exercisesGetResourceTilingfor subresource ranges starting at index 1 (start_sub: 1, count: 2), asserting full parity ofactual_countand per-subresource tiling info between host D3D12 and XCL without assuming adapter-specific tile counts. Tested on GTX 1650 SUPER (3/3 passed).upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
Imported from ivall/xcl. Originally posted by towiice on 2026-11-25T02:01:53Z.
Squashed the four commits into one (
eba5e09). The tree is identical to5497e00, so the reports above on that head apply to the same code. (Posted with Claude Code, Claude Sonnet 5.5.)upstream-sync referenced this pull request2026-11-25 03:04:25 +00:00
upstream-sync referenced this pull request2026-11-25 07:04:28 +00:00
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:37:00Z.
Empirical test report (
eba5e09d)Hardware / environment
eba5e09dd4abc3acbd3eeaffd01501866f3b600d(detached HEAD, clean worktree).32.0.101.9175. AMD Ryzen 7 3800X 8-Core Processor.10.0.26200. Rust1.100.0 (0ef1bc386 2026-11-09),x86_64-pc-windows-msvc. DXC1.9.2609.5 (01b62ad47). Unoptimized Cargo test profile.Commands and results
cargo test --workspace --no-runexited 0 outside the Arc lock and compiled the workspace test executables.Invoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1.Each test and the Arc wrapper exited 0. Totals were 3 passed / 0 failed / 0 ignored / 0 skipped, with zero case-sensitive
^SKIPPEDlines. All three runs logged the real D3D12.X backend on the Arc A770.Observed behavior
E_NOINTERFACEfor the synthetic console IID. XCL retried withIID_ID3D12Resourceand returned a resource with the expected dimensions and format.Not tested
The full GPU workspace suite and game smoke runs were omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr617-focused.log and published.
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T08:47:04Z.
Test report for head
eba5e09as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 688 passed, 0 failed, 41 ignoredtests/d3d12_create_reserved_resource.rs) ran against the NVIDIA host driver and passed:pc_reserved_resources_match_host_driver,unknown_console_iid_falls_back_to_pc_resource_interface,reserved_resource_clear_value_and_null_ppv_match_hostXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:55:40Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by ivall on 2026-11-25T19:23:56Z.
Merging:
CreateReservedResourceand its tiling against the host driver.Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug,
main2898511with 27 test PRs merged locally, this one included: the whole suite 3 times, 1419 passed, 2 failed, 46 ignored each time (fuzz_validate_and_gpu_1and_3, which fail the same way onmain);hle::d3d12xon 16 threads 5 times, no failure. This file alone 8 times: no failure.AI use: Claude Code (Claude Opus 5.5) reviewed and tested this and wrote the comment on the maintainer's behalf.