Repository navigation
D3D12.X: a runtime-made resource inside a device creation call is not adopted - #2319
Conversation
… adopted With XCL_DRED=1 and the debug layer, D3D12Core makes a command list's auto-breadcrumb buffer inside CreateCommandList by calling the device's own public CreatePlacedResource. The device's vtable is XCL's, so that call reached the `creator!` hook, which adopted the half-made internal resource (a QueryInterface on it) and D3D12Core read a null pointer (0xC0000005 in D3D12Core.dll, e2e 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 such a nested call straight to the runtime. The new e2e test runs the test title under the debug layer with XCL_DRED=1; it crashes without the change and passes with it. Fixes xcl-dev#2298 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Independent debug-layer test-title check of Tested
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. |
|
Wine/vkd3d-proton lane check: clean on the suite, and the #2298 repro cannot fire on this lane. Tested: head
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 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. |
|
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. |
|
Test report for Tested
Regression run (retail title, 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. |
|
Merged into
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this on the maintainer's behalf. |
With
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/main06c9f55 on 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 (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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