Skip to content

Tests: verify CreateHeap console fallback and IID retry against host driver - #564

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
GustavoEllwanger:test/d3d12-create-heap-fallback
Nov 25, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
GustavoEllwanger:test/d3d12-create-heap-fallback

Conversation

@GustavoEllwanger

Copy link
Copy Markdown
Contributor

What is in it
Adds a standalone integration test (crates/xcl/tests/d3d12_create_heap.rs) that verifies XCL's CreateHeap vtable hook (d3d12x::real::dev_create_heap) and creator! E_NOINTERFACE fallback directly against the host PC D3D12 driver on the same adapter, with no console files or game data required:

  • Captures the unadopted ID3D12Device::CreateHeap entry point and adapter LUID before d3d12x::real::init() adopts the device vtable, then verifies both target the same adapter and that the CreateHeap vtable slot is intercepted by XCL.
  • Verifies standard PC heap descriptions (DEFAULT, UPLOAD, READBACK) succeed through both the host driver and XCL with matching ID3D12Heap::GetDesc() values.
  • Verifies console-only heap descriptions refused by the raw host driver (console flag bits such as 0x2 / 0x10 / high bits, unknown heap types outside 1..=5, unaligned sizes, non-64 KiB alignments, and a combined console heap) succeed through XCL with normalized PC heap descriptors (known flags only, DEFAULT type, 64 KiB rounded size, and 64 KiB / 4 MiB alignment).
  • Verifies an unknown console IID fails on the raw host driver with E_NOINTERFACE and succeeds through XCL's creator! fallback returning a usable ID3D12Heap.

Tested

  • Adapter: AMD Radeon RX 7600 (8133 MiB VRAM, RDNA3, Adrenalin 26.11.2 / driver 32.0.32029.2010), Windows 11 x64.
  • cargo test -p xcl --test d3d12_create_heap -- --nocapture: 3 passed, 0 failed, 0 ignored (RX 7600).
  • XCL_ADAPTER=warp cargo test -p xcl --test d3d12_create_heap -- --nocapture: 3 passed, 0 failed, 0 ignored (WARP software renderer).
  • cargo test --workspace -- --test-threads=4: 680 passed, 0 failed, 41 ignored, 0 SKIPPED.

Not tested

  • Retail Xbox games (scripts/smoke.ps1 not run; test-only PR with no changes under crates/xcl/src/).
  • Non-AMD GPUs (NVIDIA / Intel hardware).

AI use
Written and verified with Antigravity (Gemini 4 Carbon); all commands and tests were run locally on this machine's RX 7600 and WARP adapter.

@CryingLaughing

Copy link
Copy Markdown

The exact head 73cf88915070b7b7c239459068fcca91a9aae889 passed the three CreateHeap driver comparisons on an RTX 4080. This adds native NVIDIA coverage to the RX 7600 and WARP runs.

Tested

  • RTX 4080, NVIDIA driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug. XCL_ADAPTER=4080, XCL_REQUIRE_GPU=1, and all XCL_SAMPLE_* variables unset. The fixture identified the RTX 4080 and checked the matching adapter LUIDs.
  • cargo test -p xcl --test d3d12_create_heap --locked -j 4 -- --show-output --test-threads=1: 3 passed, 0 failed, 0 ignored, 0 capability skips.
  • The default, upload, and readback descriptors matched the host. All five console descriptor cases were rejected by the raw driver and accepted with the expected normalization by XCL. The unknown-IID test passed its native rejection and XCL fallback checks.

Not tested

  • The full workspace for this head, other adapters on this machine, release builds, or retail titles.

AI use

  • OpenAI Codex (GPT-6 family, exact variant unavailable) ran the tests and drafted this report.

@towiice towiice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested PR head 73cf889 on NVIDIA GeForce GTX 1650 SUPER (Turing / TU116, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (stable-x86_64-pc-windows-gnullvm), DXC v1.9.2609:

  • cargo test -p xcl --test d3d12_create_heap -- --test-threads=4: 3 passed, 0 failed (1.68 s):
    • unknown_console_iid_falls_back_to_pc_heap_interface
    • pc_heap_descs_match_host_driver
    • console_heap_descs_refused_by_host_are_normalized_by_xcl

All CreateHeap host-driver comparison tests pass on NVIDIA Turing.

@caua-an

caua-an commented Nov 24, 2026

Copy link
Copy Markdown

Tested: Clean head 73cf88915070b7b7c239459068fcca91a9aae889; 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.

With XCL_ADAPTER=intel, cargo test --offline --locked -p xcl --test d3d12_create_heap -- --test-threads=1 --nocapture: 3 passed, 0 failed, 0 ignored, no skips. The fixture identified Intel Arc and verified matching adapter LUIDs for the host and XCL devices. PC heap parity, console descriptor normalization, and the unknown-IID fallback all passed.

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.

@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 73cf88915070b7b7c239459068fcca91a9aae889 on AMD RDNA4. I merged it onto current main dd2ae9a locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 693 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 650 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the three d3d12_create_heap tests pass.

Review: AMD RDNA4 next to the RX 7600, WARP, RTX 4080 and Intel runs above. The test captures the driver's own CreateHeap before real::init() adopts the vtable and compares both on one adapter; when there is no device it calls skip_test. 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 onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@JoaoPauluu

JoaoPauluu commented Nov 24, 2026 •

Copy link
Copy Markdown

Update, c7b7ebe: all 3 tests pass under Wine with vkd3d-proton now, in 3 runs of the whole binary plus one run of each test on its own process, none skipped. Same setup as below, except a release build of c7b7ebe (based on 1a0bbe3, no uncommitted changes).

  • console_heap_descs_refused_by_host_are_normalized_by_xcl: vkd3d-proton still accepts console_flags_0xC2_and_high_bits (no refusal in the log). The other four cases are refused (0x80070057) and come back normalized, for example CreateHeap(0x10001 bytes, type 9, alignment 0x4000, flags 0x200000d2) refused (0x80070057); as type 1, alignment 0x0, flags 0xc0: 0x0. That matches the new "at least 4 of 5 refused, combined_console_heap included" check.
  • pc_heap_descs_match_host_driver and unknown_console_iid_falls_back_to_pc_heap_interface: ok.

Test report: #564 under Wine with vkd3d-proton as the host driver (Linux, NVIDIA)

The other runs are native Windows drivers (RX 7600, WARP, RTX 4080, Intel Arc, RX 9060 XT). Under Wine the "host driver" is vkd3d-proton, and there one case of console_heap_descs_refused_by_host_are_normalized_by_xcl fails: vkd3d-proton accepts the console flags 0x100000C2, so the test's hr_host < 0 precondition doesn't hold. The other two tests pass.

Setup

Result (d3d12_create_heap test binary under Wine, --test-threads=1, three runs): 2 passed, 1 failed, every time.

  • pc_heap_descs_match_host_driver: ok
  • unknown_console_iid_falls_back_to_pc_heap_interface: ok
  • console_heap_descs_refused_by_host_are_normalized_by_xcl: console_flags_0xC2_and_high_bits: host driver unexpectedly accepted console heap desc (line 232)

To see the other cases, I changed the hr_host < 0 assert locally into a print plus continue (not kept, file restored):

case vkd3d-proton CreateHeap
console_flags_0xC2_and_high_bits 0x0 (accepted)
unknown_console_heap_type 0x80070057
unaligned_size_and_small_non_pc_alignment 0x80070057
alignment_above_64k_promoted_to_4m 0x80070057
combined_console_heap 0x80070057

With that change the test passes: the four refused cases go through XCL's retry and come back normalized.

When the assert is only turned into a print (no continue), the next assert fails: console-only heap flag bits remained: 0x100000c2. dev_create_heap only normalizes after the host refuses, so on vkd3d-proton the title's heap keeps the console bits in its GetDesc(). I don't know whether anything reads them back; GTA VI ran without device removals on this setup (see my reports on #257 / #632).

Not tested

  • Windows, AMD, other Wine / vkd3d-proton versions; the rest of the suite on this branch; a title run (test-only PR)

AI use: Claude Code (Claude Opus 5.5) built the test, ran everything above 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 and has not reviewed this one.

@GustavoEllwanger
GustavoEllwanger force-pushed the test/d3d12-create-heap-fallback branch from 73cf889 to c7b7ebe Compare November 25, 2026 12:06
@GustavoEllwanger

Copy link
Copy Markdown
Contributor Author

Thanks @JoaoPauluu for the Wine/vkd3d-proton report! Updated head \c7b7ebe\ (rebased on \main\ \1a0bbe3): when a permissive host driver accepts a console heap desc directly, the test verifies XCL matches the host instead of requiring a host refusal, while still asserting that at least 4 of the 5 console cases (including \combined_console_heap) are refused by the host and normalized by XCL. Re-verified 3/3 passing on both NVIDIA RTX 5060 and AMD Radeon RDNA2.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@ivall
ivall merged commit 8b38c1d into xcl-dev:main Nov 25, 2026
2 checks passed
@ivall

ivall commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Merging: CreateHeap, its console fallback and the IID retry against the host driver.

Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, main 2898511 with 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_1 and _3, which fail the same way on main); hle::d3d12x on 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.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants