D3D12.X: clamp single-adapter NodeMask and guard null riid in CreateCommandSignature #3400
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3400"
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 Kalmarv on 2026-11-29T13:30:17Z.
Clamp multi-bit
D3D12_COMMAND_SIGNATURE_DESC::NodeMaskvalues to single-adapter1and guard nullriidincreate_command_signature_x.Previously,
device_x::create_command_signature_xforwardedD3D12_COMMAND_SIGNATURE_DESC::NodeMaskunchanged to PCCreateCommandSignature(and copied it into theDISPATCH_MESHcompanionDISPATCHsignature). On single-adapter PC D3D12, anyNodeMask > 1(for example0x3or0xFFFF_FFFF) is rejected withE_INVALIDARG(0x80070057), unlikepc_queue_descandcreate_listin the same module which already clamp nonzero node masks to1. It also did not guard a nullriidpointer before forwarding to the PC runtime.What is in it
crates/xcl/src/hle/d3d12x/device_x.rs:pc_command_signature_node_maskclamping nonzeroNodeMaskvalues to1while keeping0as0.pc_command_signature_node_masktopc[16..20]increate_command_signature_xbefore callingreal::dev_create_command_signature(so both the main signature and anyDISPATCH_MESHcompanion signature use the clamped mask), log both original and clamped masks on failure, guardriid.is_null()alongsidedesc.is_null() || ppv.is_null(), and check!(*ppv).is_null()before recording companion state.pc_command_signature_node_mask_clamps_to_single_adapterand child-process-isolated WARP testcreate_command_signature_x_clamps_node_mask_and_guards_null_argsverifying consoleDispatchXwithNodeMask = 0x3,DRAWwithNodeMask = 0xFFFF_FFFF, nulldesc/riid/ppvhandling, and rejection of undersizedByteStride.Tested
rustc 1.99.0 (b940084d7 2026-09-28), DXC 1.9 (XCL_DXC_DIR), debug for tests and release forxcl-smoke.cargo test -p xcl --lib -- hle::d3d12x::device_x::tests:: --nocapture):create_command_signature_x_clamps_node_mask_and_guards_null_argsfailed before the fix (NodeMask 0x3 must clamp to 1 on single-adapter PC D3D12, got 0x80070057), and all 22device_xtests passed after (22 passed, 0 failed,0.14s,0skips).cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests::): 2663 passed, 0 failed, 49 ignored, 9 filtered across 41 test binaries.SKIPPEDGPU tests on this wave32 adapter (26 total across--nocaptureworkspace baseline): 21no wave64(RTX 5070 Ti is wave32), 3 wave32 per-lane#1426f16/cvt-f16 refusals, 2no heap windows(opt-inXCL_HEAP_WINDOWS=1).ea3b5e4d) 150 s regression run below (0device removals,0crashes,1620frames vs1695onmain,33840 MBpeak commit vs31546 MBonmain).Regression run
Not tested
NodeMask > 1is clamped to1for single-adapter PC D3D12 parity withpc_queue_descandcreate_list) and AMD RDNA / wave64 GPUs.uma_driver::tests::(skipped locally due to pre-existing0x7C10003exit on NVIDIA) andtest_title_runs_and_game_folder_is_untouched.AI use
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-29T14:20:51Z.
Reviewed and tested at
c586fbba.Looks clean and tightly scoped —
NodeMaskclamping, null-riidguard, and isolated WARP child-process test all look good.Tested locally
32.0.16.2140), AMD Ryzen 7 7800X3D,rustc 1.100.0.cargo test -p xcl --lib hle::d3d12x::device_x::tests::pc_command_signature_node_mask -- --test-threads=1: 1 passed, 0 failed.cargo test -p xcl --lib hle::d3d12x::device_x::tests::create_command_signature_x_clamps_node_mask -- --test-threads=1: 1 passed, 0 failed.AI use
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T16:03:08Z.
Test report for #3400 at
c586fbbadfcef075e3ecff67450525ebbd5fb87c, against its merge-base withmain,7a649b0e, under Wine on AMD.Tested
experimental-11.0-20261112, stock vkd3d-protonmaster71cae091. Debug build,x86_64-pc-windows-gnu, under Wine. It wasn't run on Windows.cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>.--test-threads=1 <name>): both pass:create_command_signature_x_clamps_node_mask_and_guards_null_args,pc_command_signature_node_mask_clamps_to_single_adapter. 2 passed, 0 failed.--test-threads=2, with--skip gpu::and these six:failed_restore_stops_before_importing_an_unbacked_window,grooming_leaves_a_window_under_1_gib_only_its_hole(both run out of memory here),write_buffer_immediate_on_open_existing_heap_visible_to_cpu,coherent_buffer_sanitizes_console_flags_and_state,serialize_root_signature_strips_console_flags_and_preserves_pc_flagsandexecute_indirect_reads_the_arguments_written_before_it. Under Wine each of the last four ends the process or makes RADV reject later submissions (#3067), so without them the suite reaches its summary:c586fbba: 1520 passed, 112 failed, 5 ignored7a649b0e: 1518 passed, 112 failed, 5 ignoredmain's known ones on stock vkd3d-proton: list creation refused (E_INVALIDARG, #175 / #1701) and the tests after it (#3067).Not tested
gpu::tests in the suite runs-p xcl --lib)AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:32:50Z.
merge-check
base:
d0832e614fhead:
c586fbbadfmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (device_x.rs, +108/-5). Masks 0 and 1 reach the PC unchanged, and the DISPATCH companion signature copies the clamped mask. Findings: (1) the WARP test (~1527-1535) returns silently when there is no factory, WARP adapter or device; it should call
skip_testlike the test at ~1930. (2) The null-riidguard (~1406) and the!(*ppv).is_null()check (~1432) are separate changes from the clamp, and only the NodeMask assertion is shown failing without the fix. (3) This is another copy of the "nonzero becomes 1" clamp (pc_queue_desc,create_list, #3387, #3385, #3403); one shared helper would be better. (4) AI use says "Antigravity (Gemini)" with no exact model; the suite run skippeduma_driver::tests::andtest_title_runs_and_game_folder_is_untouched; the subject is ~84 characters; no title is cited that passes NodeMask > 1. Fine: the clamp matchespc_queue_desc/create_list, the failure log keeps the original mask, and the mask-0x3 test drives the realcreate_command_signature_xin a child process.performance: 60 s smoke of a retail title, main
d0832e61vs this merge (e09962c8): 1516 -> 1679 frames shown (110 %; last presents per 2 s: 61 60 60), peak commit 18133 -> 16994 MB, 0 device removals, 0 crashes.verdict: safe to merge (the WARP test should call skip_test instead of returning; a shared node-mask helper across this series would be better)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T06:55:34Z.
merge-check
base:
d0832e614fhead:
c586fbbadfmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; failing: none (25 SKIPPED lines, all GPU tests on this adapter, e.g. no wave64)
review: Read the whole diff (1 file, device_x.rs). CreateCommandSignature now clamps a multi-bit NodeMask to 1 for the single-adapter PC runtime, rejects a null riid, and checks *ppv before noting the signature; the warning log prints both masks. The new unit test covers the clamp helper, and a WARP-device test (run in a child process of the test binary, which is the only process code in the diff) checks masks 0x3 and 0xFFFFFFFF, the null arguments and an undersized stride. The child returns silently when there is no WARP adapter, so the parent shows no SKIPPED line then. Scope is one function.
performance: no cost by default: one mask compare per CreateCommandSignature call, which is a creation-time call, not per frame; reasoned, not measured.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report (the diff review is Sonnet's)
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T07:00:31Z.
Merged at the checked head after a combined trial of #3400, #3386, #3393 and #3535 on
maind0832e61(RTX 4080 16 GB,cargo test --workspace --no-fail-fast -- --test-threads=4: 2896 passed, 0 failed, 51 ignored, 25 SKIPPED lines). Two merge checks: Foniass and ours.AI use: Claude Code (Claude Opus 5.5).