D3D12.X: strip console-only root-signature flags in D3D12SerializeRootSignature #2437
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2447"
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 Decodere on 2026-11-25T19:18:29Z.
What is in it
Strip Xbox console-only root-signature flags in
D3D12SerializeRootSignatureand share sanitization/error-blob handling withD3D12SerializeVersionedRootSignatureincrates/xcl/src/hle/d3d12x/mod.rs(+105/-34lines, single file):D3D12SerializeVersionedRootSignaturealready stripped console-only bits abovePC_FLAGS = 0xFFF(such as0x3000000) and logged/cleaned up error blobs, whereas 1.0D3D12SerializeRootSignatureforwarded rawD3D12_ROOT_SIGNATURE_DESCdirectly to Windowsd3d12.dll, which rejects unknown flag bits withE_INVALIDARG(0x80070057).serialize_root_sig<const QWORDS: usize>helper withPC_FLAGS = 0xFFF: copies the descriptor into an 8-byte-aligned stack buffer (40bytes / flags at+32forD3D12SerializeRootSignature;48bytes / flags at+40forD3D12SerializeVersionedRootSignature) only when!PC_FLAGSbits are set, drops unknown bits without mutating the caller's struct, zeroes caller-provided*errbefore forwarding, logs error-blob diagnostics on failure even whenerrisNULL, and releases temporary error blobs cleanly.hle::d3d12x::tests::serialize_root_signature_strips_console_flags_and_preserves_pc_flags) verifying descriptor layout offsets, console-flag stripping and PC-flag preservation viaD3D12CreateRootSignatureDeserializerfor both 1.0 and versioned serializers, caller-struct immutability, Windows 10 in-box / Agilityd3d12.dllfailure handling without assuming non-empty runtime error text on unknown versions (guardingblob_releasewhenerr_outis null), and runtime-independent error-blob forwarding andown_errcleanup via a mockID3DBlobvtable.Part of #1452
Part of #1333
Tested
origin/main(569f0fc5):XCL_ADAPTER=warp cargo test -p xcl --lib hle::d3d12x::tests -- --test-threads=1 --nocapturefailed1of1(D3D12SerializeRootSignature rejected console flags: 0x80070057).hle::d3d12x::tests(bd586636, rebased ontoorigin/maine1d84b7d):XCL_ADAPTER=warp cargo test --release -p xcl --lib hle::d3d12x::tests -- --test-threads=1 --nocapture):1 passed; 0 failed; 0 ignored(0.14 s).cargo test --release -p xcl --lib hle::d3d12x::tests -- --test-threads=1 --nocapture):1 passed; 0 failed; 0 ignored(0.37 s).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture, RTX 4060):37test binaries,1424 passed; 0 failed; 46 ignored.29pre-existingSKIPPEDlines on this RTX 4060 host (21no wave64,3per-lane wave32 refused,3no D3D12 debug layer /d3d12SDKLayers.dll,1no heap windows,1cannot disable driver cache;0skipped inhle::d3d12x::tests).Regression run
Paired 60 s RTX 4060 smoke (
scripts/smoke.ps1 -Seconds 60) on baseorigin/mainvs PR head (1566vs1550frames =101.0%,60 60 60steady pace,0device removals,0crashes):Base (
origin/main):PR head:
Not tested
D3D12SerializeRootSignaturewith console-only flag bits (console-only flag stripping, PC-flag preservation viaD3D12CreateRootSignatureDeserializer, and error-blob cleanup are covered by the unit test against real Windowsd3d12.dlland mockID3DBlob).d3d12.dllwithout Agility SDK (this host runs Windows 11 26200; the updated test removes the assumption that unknown-version failures emit non-empty"version"text and guardsblob_releaseon null).d3d12SDKLayers.dllnot installed on this host).AI use
Written and verified with Google Antigravity (Gemini 4 Neon). All changes were validated locally with failing-first WARP tests, full release workspace tests, and paired 60 s RTX 4060 smoke runs.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T20:02:44Z.
gpu_suite (cold cache): 160 passed / 4 failed, no crashes. The four are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, depth-buffer state refusal, andgpu_promoted_uav_clear_values_pass_create_committed_resource(report); none caused by this PR.(
empty_stream_descriptors_do_not_change_the_keywas not picked up by substring filter in the--libtarget; suite covers the gpu-side changes.)Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:37:59Z.
Review: COMMENTED
No code-level blocker found. The shared helper preserves the caller descriptor, strips only console-only bits for both layouts, and current Windows CI is green. Nonblocking test gap: shared error-blob handling is covered only through the 1.0 serializer. A failing versioned-serializer case with NULL/non-NULL error output would validate ownership/reset in that path.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:21:56Z.
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!
upstream-sync referenced this pull request2026-11-25 22:05:21 +00:00
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T22:21:48Z.
Test run on exact head
75c835d(75c835d425f8a614d346aceaf3402d23c0f1785d, on its base2898511), clean tree.Tested
cargo test --workspace -- --test-threads=4: 1364 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo)cargo test -p xcl --lib serialize_root_signature: 1 passed, 0 failedserialize_root_signature_strips_console_flags_and_preserves_pc_flags: okRegression run (60 s, default settings, a retail title)
main:
this PR:
No crash or device removal; frames 104 % of
main's, peak commit 100 %.Not tested
main(tested on its own base; it merges intoe1d84b7without conflicts)AI use
Imported from ivall/xcl. Originally posted by HAL9000RELOADED on 2026-11-25T22:53:10Z.
Windows 10 data point for
75c835d: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045.6456), Rust 1.98.1 MSVC.serialize_root_signature_strips_console_flags_and_preserves_pc_flags:XCL_D3D12_DIR), on the card and withXCL_ADAPTER=warp: passes. Merged on6d12f58it also passes with the whole crate.XCL_D3D12_DIR), card and WARP, merged on889ef3e: fails with "caller error blob missing diagnostic". The flag checks before that pass; only the version-99 case differs. The in-boxD3D12SerializeRootSignaturefails as expected but its error blob has no text (I printed it:""), socontains("version")is false.So the stripping works on Windows 10 too. The last assertion depends on the runtime's error text, which the in-box runtime doesn't give. Checking only the failure code there would let the test pass on Windows 10 without Agility.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T23:05:18Z.
@HAL9000RELOADEDThanks for the Windows 10 in-boxd3d12.dlltest point!Updated in
bd586636(and rebased ontoe1d84b7d): theversion = 99check now verifies the failure HRESULT and*errinitialization without assuming non-empty"version"text on in-box Windows 10 runtimes (and guardsblob_releasewhenerr_outis null), while a runtime-independent mockID3DBlobcheck onserialize_root_sigdeterministically covers caller error-blob forwarding and internalown_errcleanup. Re-verifiedhle::d3d12x::tests(1/0on both WARP and RTX 4060), full release workspace (1424 passed, 0 failed), and paired 60 s smoke (1550 -> 1566,0crashes/removals).Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T01:50:05Z.
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
Imported from ivall/xcl. Originally posted by HAL9000RELOADED on 2026-11-26T09:29:33Z.
Re-run at
bd58663on the same Windows 10 22H2 (19045) machine, RX 7900 XTX (RDNA3), driver 32.0.32015.7029.XCL_D3D12_DIR):serialize_root_signature_strips_console_flags_and_preserves_pc_flagspasses, 3/3 runs.XCL_D3D12_DIR): passes too.At
75c835dthe same test failed here on the in-box runtime, so the change covers it.AI-assisted (Claude Code): tests run on my machine, text drafted with Claude.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T03:38:41Z.
merge-check
base:
fa204595a4head:
bd58663616merge: clean (trial merge 8cae7feacb6be1bfd421a719e8d58eee091f2190, local, not pushed; mod.rs auto-merged;
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2605 passed, 4 failed, 49 ignored; SKIPPED: 26, the usual set (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows). The new
hle::d3d12x::tests::serialize_root_signature_strips_console_flags_and_preserves_pc_flagsran and passed. The 4 failures are one flake in code this PR doesn't touch:shaders::pipeline_library::tests::builder_deduplicates_names_and_atomically_replaces_outputcounted 4 library entries instead of 2 (finishcounts a process-global builder that other tests can add pipelines to while it runs in parallel). Its panic poisoned the sharedBUILD_TESTlock, which then failedgraphics_pipeline_round_trips_through_serialized_library,mesh_pipeline_round_trips_through_serialized_libraryandwarm_library::cold_publish_makes_an_unchanged_corpus_reusablewithPoisonError. All 10pipeline_library/warm_librarytests passed when rerun alone on the same merge.review: none blocking; whole diff read.
D3D12SerializeRootSignaturenow strips console-only flag bits (anything outside0xFFF; seen:0x3000000from XboxBvhBuilder.dll) the same wayD3D12SerializeVersionedRootSignaturealready did. Both go through oneserialize_root_sig, which copies the 40-byte 1.0 desc (flags at +32) or the 48-byte versioned desc (flags at +40) before changing it, so the caller's desc is untouched. The test checks those sizes and offsets withsize_of/offset_of!, and the reads are unaligned-safe. Dispatch is the same as the oldforward!macro: the system export on the Real backend, otherwisenull::. The failure log now names the entry point and reads parameters / samplers / flags at the right offsets for each version. One behaviour change: a non-nullerris set to null on entry, so a caller's error pointer is always initialized; that matches the runtime's contract and the test covers it. The error blob is released only when the caller passed noerr.performance: none to speak of (one 40/48-byte copy, only when console bits are set). Title run (release build of the merge, scratch/fast-world.py fast profile, about 85 s in world): exit 0, 0 crashes, 0 device removals, world entry 80.0 s, peak commit 31,227 MB, 68 WARN lines,
failed_pipelines0, no translation errors, no new WARN kinds against a mainfa204595run on the same harness (world entry 76.8 s, peak commit 33,027 MB, 86 WARN lines). This title only calls the versioned entry point: 17 "D3D12SerializeVersionedRootSignature: console flags 0x3000000 dropped" lines on both main and the merge, and noD3D12SerializeRootSignaturecall. So at run time the refactored versioned path behaves as before, and the new 1.0 stripping is covered only by the unit test. Both runs show 0 fps in the world because the cache doesn't match the translator identity.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite, title run and full-diff review; this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T07:50:45Z.
merge-check claim
head:
bd58663616Imported from ivall/xcl. Originally posted by throny on 2026-11-29T08:09:40Z.
merge-check
base:
fa204595head:
bd58663616merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2609 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
fa204595: 2608 passed, 0 failed, 49 ignored.review: no blocking finding. The flag stripping moves into one shared function and now also covers the 1.0 descriptor; offsets, copy sizes and the error-blob handling are right, and the caller's descriptor is not changed. One behaviour change: a caller's error pointer is now set to null before the call, as the null backend already did. Two notes on the test: it creates the process-wide real device inside a unit test (with the null backend configured it would fail on E_NOTIMPL), and it asserts what the system's d3d12.dll does with an unknown version and a null descriptor, which may differ between Windows builds. It passed here on Windows 11 26300.
performance: none expected (one small copy per serialize call); not measured.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T13:57:42Z.
Review: COMMENTED
Code review of head
bd58663— no blocking finding in the change.I checked the 40-byte and 48-byte descriptor copies, flag offsets, preservation of caller memory, forwarding of the error-blob pointer, and release of an internally captured error blob. The test covers both serializer exports and success/failure handling. I did not run the Windows/WARP suite here; the results in the PR description are author reported.