D3D12.X: a runtime-made resource inside a device creation call is not adopted #2319
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2319
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2319/head"
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?
@oni-swr on GitHub · 2026-11-25 14:03 UTC · original
oni-swr:d3d12x-dred-debug-layer-placed→main· +34 −2 · 2 files · 1 commits · merged 2026-11-25 16:54 UTCWith
XCL_DRED=1and the D3D12 debug layer, D3D12Core makes a command list's auto-breadcrumb buffer insideCreateCommandListby calling the device's own publicCreatePlacedResource. The device's vtable is XCL's, so that call reached thecreator!hook, which adopted the half-made internal resource (aQueryInterfaceon it) and D3D12Core read a null pointer (0xC0000005inD3D12Core.dll, test title, after the retail-format shader check).creator!now notes when it is already inside a call of its own on the thread and passes a nested call straight to the runtime. Fixes #2298.Found by taking the stack at the crash:
CreatePlacedResource(XCL's hook) sits under D3D12Core'sCreateCommandList. Not the cause (tried and ruled out): DRED's ownSetMarker/SetNamecalls indred.rs, page-fault reporting (only auto-breadcrumbs matter), the command allocator's or pipeline's adoption. A plain D3D12 program with the same layer and DRED settings does not crash.What is in it
crates/xcl/src/hle/d3d12x/real.rs: a thread-localIN_CREATORguard in thecreator!macro.crates/xcl/tests/e2e.rs: the debug-layer test body becomestitle_under_the_debug_layer(dred); the old test calls it withfalse, the newtest_title_runs_under_the_debug_layer_with_dredwithtrue(setsXCL_DRED=1). The new test crashes without thereal.rschange (checked) and passes with it.Tested
XCL_DRED=1 cargo test -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layerfailed before the fix (sameD3D12Core.dll+0x606fbnull read as in the issue); the two debug-layer e2e tests pass after itcargo test --workspace --no-fail-fast -- --test-threads=4on this commit: lib 1195 passed, 1 failed, 26 ignored; every other test target passed. The one failure,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722,res[30] = 0x1, CPU 0x7fffffff), fails the same way onorigin/main06c9f55on this GPU.f16_programs_on_the_gpu(f16 arithmetic and packed, wave32 and wave64) andf32_programs_on_the_gpu(f32 conversions, wave32 and wave64): refused V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (#1426);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsRegression run
main(06c9f55):This PR (
41dac1f):Same title, 60 s each.
Not tested
XCL_DRED=1on a retail title: the smoke runs above are without the debug layerAI use
🤖 Generated with Claude Code
@nnonno91 on GitHub · 2026-11-25 14:17 UTC · original
Independent debug-layer test-title check of
41dac1f367c358b8964a524a78003a5c62aa9509.Tested
cargo build --locked --workspacepassed.cargo test --locked -p xcl --test e2e under_the_debug_layer -- --nocapture --test-threads=1withXCL_NETWORK=0gave 2 passed, 0 failed and 0 ignored with each ofXCL_ADAPTER=AMD RadeonandXCL_ADAPTER=NVIDIA GeForce RTX 5090. No skips. In each run the repository test title ran to completion with the debug layer enabled, both with and without DRED, and the test's log assertions passed.Not tested
The old revision, retail gameplay and the full workspace suite.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the checks, verified the logs and wrote this report.
@SlopTart on GitHub · 2026-11-25 14:17 UTC · original
Wine/vkd3d-proton lane check: clean on the suite, and the #2298 repro cannot fire on this lane.
Tested: head
41dac1f3(already contains currentorigin/main, fast-forwards onto it), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (--release --locked,--test-threads=2): 142 passed / 3 failed / 1 ignored, identical to plainorigin/mainon this rig. The 3 are the rig's known baseline (fuzz seed 1003 of #2115,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed). No delta from this change.test_title_draws_with_a_root_signature_under_the_debug_layer, reports:SKIPPED ... (dred: false): no d3d12SDKLayers.dll. vkd3d-proton ships no SDK Layers DLL, so the nestedCreatePlacedResourcereentry that crashes D3D12Core on Windows never happens here; the fix is a no-op on this lane and nothing regresses with it in.One note for the fix itself: the pass-through for nested calls keys on "already inside one of its own calls on the thread". Under Wine the device vtable is also reached from vkd3d-proton's own threads via the same hooks; nothing observable broke in the suite, but the nested-call detection is thread state, not call state, if a title ever calls
CreateCommandListfrom one thread while another thread is insideCreatePlacedResource. Counting by call nesting instead of thread entry might be the safer shape; this is a reading of the diff, not a measured failure.Not tested: Windows with the Agility SDK debug layer (the actual #2298 crash path); retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@thehollowedone on GitHub · 2026-11-25 15:08 UTC · original
Independent full Windows suite on 41dac1f, based on 06c9f55. RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC, DXC 1.8.2502.11, inbox D3D12.
Synthetic fixtures only. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
@S1m0ne1997 on GitHub · 2026-11-25 15:12 UTC · original
Test report for
41dac1f367c358b8964a524a78003a5c62aa9509(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 1266 passed, 0 failed, 46 ignored.dispatch_chain_native_wave64_builds_whole(no wave64),a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu(no wave64),coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu(no wave64),cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu(no wave64),the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu(no wave64),a_per_lane_2d_or_3d_group_runs_on_the_gpu(no wave64),const_and_null_mask_operands_agree_with_hlsl_on_the_gpu(const_mask, wave64: no wave64),f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)); f16 arithmetic, wave64: no wave64),f32_programs_on_the_gpu(f32 arithmetic, wave64: no wave64; f32 compares, wave64: no wave64),f64_programs_on_the_gpu(f64, wave64: no wave64),integer_programs_on_the_gpu(integer arithmetic, wave64: no wave64; integer carries, wave64: no wave64),mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(mask_ff0_flbit, wave64: no wave64),gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache (Windows Developer Mode is required): L'applicazione ha richiesto un'operazione che dipende da un componente SDK mancante o non corrispondente. (0x887A002D)),the title under the debug layer (dred(false): no d3d12SDKLayers.dll; true): no d3d12SDKLayers.dll),uploads_start_from_each_subresources_state(no D3D12 debug layer (L'applicazione ha richiesto un'operazione che dipende da un componente SDK mancante o non corrispondente. (0x887A002D))).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head with no changes tocrates/, both run with thescripts/smoke.ps1ofmain, which hashes the name of the game folder)main:
this PR:
Not tested
AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.
@ivall on GitHub · 2026-11-25 16:54 UTC · original
Merged into
main(68a284a).test_title_runs_under_the_debug_layer_with_dredand the old debug-layer test pass, also withXCL_DRED=1in the environment. Without yourreal.rschange the new test fails here with the exit code of the report (-1073741819).gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(3 group barriers, expected 1), fails the same way onmainat50a9fdewithout this PR; it came with #2074.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this on the maintainer's behalf.
@DavidM1911 on GitHub · 2026-11-25 17:52 UTC · original
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!