Skip to content

D3D12.X: null ID3D12Heap::GetDesc returns the full 48-byte heap desc - #2802

Draft
oni-swr wants to merge 1 commit into
xcl-dev:mainfrom
oni-swr:t3/xcl-2783-null-heap-getdesc
Draft

oni-swr wants to merge 1 commit into
xcl-dev:mainfrom
oni-swr:t3/xcl-2783-null-heap-getdesc

Conversation

@oni-swr

@oni-swr oni-swr commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The null backend's ID3D12Heap::GetDesc zeroed only bytes 0-39 of the 48-byte D3D12_HEAP_DESC, so Flags (offset 40) kept whatever the caller's buffer held. The null heap now keeps the desc it was created with and GetDesc writes all 48 bytes.

Fixes #2783

What is in it

  • crates/xcl/src/hle/d3d12x/null.rs: CreateHeap / CreateHeap1 keep the desc (new_heap), Heap_GetDesc48 writes all 48 bytes in both calling orders, and the now unused Hidden_ZeroDesc40 is removed. The other null GetDesc slots (command queue 16 bytes, descriptor heap 16 bytes, resource 56 bytes) already match their structs. Test heap_get_desc_fills_all_48_bytes: sentinel-filled buffers, both orders, and a heap created without a desc reads back zeroed.

Tested

  • AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 Pro 10.0.26200, Rust 1.100.0, debug build (tests), release build (smoke)
  • cargo test -p xcl --lib -j 4 d3d12x::null: 7 passed, 0 failed, 0 ignored, 1330 filtered out
  • Whole suite on the exact head 00b0d9c4 (clean detached checkout, RX 7800 XT driver 32.0.31035.1003, no XCL_ADAPTER set, debug): cargo build --workspace -j 4, then cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4: 1435 passed, 1 failed, 47 ignored over 37 test binaries (lib: 1309 passed, 1 failed, 27 ignored). 7 SKIPPED messages: six f16_programs_on_the_gpu / f32_programs_on_the_gpu cases the lowering refuses (V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32) and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows). heap_get_desc_fills_all_48_bytes passed.
  • The one failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 ("seed 722: res[30] = 0x1, CPU 0x7fffffff", 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). It fails the same way, same seed, on main at e120925e, so it is not caused by this PR.
  • cargo clippy: nothing new on the changed lines

Regression run
Same title, 60 s each, same machine, one after the other (RX 7800 XT). Blocks pasted unedited from scripts/smoke.ps1.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 7800 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1388 (PresentX 1388)
presents per 2 s (last 3): 60 58 60
device removals: 0
crashes: 0
peak commit: 15518 MB

PR:

xcl-smoke v1
commit: 00b0d9c4d58d9412f52367c55f6c3db48e974394
gpu: AMD Radeon RX 7800 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1362 (PresentX 1362)
presents per 2 s (last 3): 59 56 59
device removals: 0
crashes: 0
peak commit: 15622 MB

Not tested

  • Other adapters (AMD RDNA4, NVIDIA, Intel): only the RX 7800 XT was used
  • The new test was not run against the old code, so I have not seen it fail there.
  • Whether the smoke title reaches the null backend: the run is a regression check only.

AI use

  • AI-assisted: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). It wrote the code, the tests and this description, and ran the commands and smoke runs above.
  • The whole-suite run on the exact head and the check of the seed-722 failure against main were made with Claude Code (Claude Sonnet 5.5), which also added them to this description.

🤖 Generated with Claude Code

The null backend's heap GetDesc slot zeroed only bytes 0-39 of the 48-byte
D3D12_HEAP_DESC, so Flags (offset 40) kept whatever the caller's buffer
held. The null heap now keeps the desc it was created with (CreateHeap and
CreateHeap1) and GetDesc writes all 48 bytes, in both calling orders; a
heap created without a desc reads back zeroed.

Fixes xcl-dev#2783

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ettehn

ettehn commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent Windows A/B of the null device’s CreateHeap1 (slot 54) followed by GetDesc (slot 8), using the same test on b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 and 00b0d9c4d58d9412f52367c55f6c3db48e974394. The output descriptor was prefilled with 0xA5 and had distinct guard bytes on both sides.

  • Main left Flags at 0xA5A5A5A5 with either argument order and failed the descriptor round-trip assertion.
  • The PR returned the original 48 bytes including Flags = 0x80, returned the caller’s output pointer in both argument orders, and preserved both adjacent guards.

Windows 11 build 26200, Ryzen 9 8945HX, Rust 1.97.1 MSVC debug. cargo test --locked --offline -p xcl --lib -j 2 -- hle::d3d12x::null::tests:: --test-threads=1 --nocapture on the PR plus the probe yielded 8 passed, 0 failed, 0 ignored, no reported skips. The main control ran just the probe and reproduced the expected failure. This check covers the null ABI path. No retail title or full workspace suite was run.

OpenAI Codex assisted with the test and verification. The exact model identifier was unavailable in this session.

@SlopTart

Copy link
Copy Markdown

Linux (Wine) dual-lane run at head 00b0d9c4

  • Rig: Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT (Mesa 26.2.5 RADV), Arch, wine-11.0 Proton build + vkd3d-proton
  • Boxb: i5-10600K, 16 GB DDR4, GTX 1070 (550.163.01), Debian 13, stock wine-10.0 + vkd3d-proton, xvfb

Suite: cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::.

Fresh main baseline measured today at 8b957bec for reference: rig 606/2 (reds: gpu_promoted_uav_clear_values_pass_create_committed_resource, xma2_source_voice_decodes_and_manages_lifetime), boxb 605/3 (those two plus write_buffer_immediate_on_open_existing_heap_visible_to_cpu). Note main's older third red on the AMD lane (sparse::a_tile_decommitted_and_committed_again_keeps_its_video_memory) is gone at current main — fixed upstream, we can confirm.

Results at 00b0d9c4: rig 597/3, boxb 597/3. The new null::tests::heap_get_desc_fills_all_48_bytes is green on both lanes. On the rig the third red is that stale sparse:: one — the head branches from an older main that still carried it; on boxb the red set is identical to current-main baseline (that test is green on Pascal there). No red anywhere is introduced by this PR.

Conclusion from two vendors: the null-device ID3D12Heap::GetDesc full-48-byte fill behaves as the test expects under both Wine stacks. A rebase onto current main would make the rig's third red disappear on contact.

Not tested: the real-device ID3D12Heap::GetDesc path (that is the standing real:: suite's job).

AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

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.

D3D12.X: null ID3D12Heap::GetDesc leaves Flags untouched

3 participants