D3D12.X: release the interface returned by QueryInterface #1147
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1156"
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 gloger2003 on 2026-11-24T12:37:43Z.
D3D12 interface discovery now releases the reference through the interface returned by QueryInterface. In the DRED and debug-layer configuration, that pointer can belong to a different wrapper.
What is in it
Tested
Regression run
Minecraft Preview 1.18.3064.0, normal D3D12 mode with identical 1x game profiles.
main:
PR:
Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:48:06Z.
Independent verification on current
main384f7f7(branch already contains it — clean).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
cargo test -p xcl --lib d3d12x::real: 19 passed, 0 failed — the QueryInterface release fix doesn't disturb the existing real-backend tests.QueryInterfacewhen the caller's contract doesn't need it — matches the README note; refcount tests ingameinput::tests::query_interface_validates_iids_and_refcountsalso pass.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T14:21:30Z.
A regression run under Wine on Linux, on a retail title.
Tested
x86_64-pc-windows-gnu.256b3f2as it is (merge base47efa2e) andmain47efa2e, no uncommitted changes. Retail title 1.0.2.1,scripts/linux/smoke.sh(#257) for 60 s, no input. Twelve runs in a row,mainfirst and last, other PRs in between.Regression run
main (first run):
this PR:
The last
mainrun: 1425 frames,exit: 0x0, no device removal, no crash. Under Wine,peak commitreads 0 MB, so these blocks do not check memory.Not tested
AI use
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
upstream-sync referenced this pull request2026-11-25 06:04:27 +00:00
Imported from ivall/xcl. Originally posted by wondercrash on 2026-11-25T05:54:24Z.
Tested on
main6020a33+ this PR (256b3f2cherry-picked; same tree as the merge). With the D3D12 debug layer and DRED both on,maincrashes at the firstCreateCommandList, and this PR fixes it. Your unit test fails onmainand passes here. The suite shows no regression.Setup: RTX 5090 32 GB, NVIDIA 621.14 (32.0.16.2114), Ryzen 7 9800X3D, Windows 11 23H2 (10.0.22631.6199), inbox
D3D12Core.dllandd3d12SDKLayers.dll10.0.22621.5415 (no Agility SDK), DXC 1.8.2502.11 from Windows SDK 10.0.26100, Rust 1.96.0 MSVC, debug.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on6020a33+ this PR: 1149 passed, 6 failed, 46 ignored (not counting the scratch GPU check below, which ran in the same suite and passed).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3fail withCreateComputePipelineState: ... (0x8007000E)(seeds 70, 545, 1019, 1507). The same four fail the same way on plain6020a33, so they do not come from this PR.frame::tests::origin_events_issue_tokens_and_flips_have_statistics("4 origins at 60 Hz took 249 ms") andkernelx::tests::fine_timer_makes_short_sleeps_short("Sleep(1) took 83 ms") are timing tests. Another heavy GPU/CPU job was running on the machine during the suite. Rerun in a filtered run of only these six tests, both pass on this PR and on6020a33.no wave64(gpu::recomp::lower,lower_dxil,recomp::tests), 3lower_dxilper-lane f16 forms refused (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32, #1426), andheap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.class_probe_tests::class_probe_releases_the_queried_interface(your unit test, added alone to6020a33): fails onmainatreal.rs:6578and passes with the fix.XCL_D3D12_DEBUG=1+XCL_DRED=1, D3D12.X real backend, thenCreateCommandAllocator,CreateCommandList,Close,ResetandCloseagain.6020a33: the test process ends with0xc0000005 STATUS_ACCESS_VIOLATIONright after XCL wraps the command allocator, duringCreateCommandList.ID3D12Resource2withPC vtable D3D12Core.dll+0x14c238(DRED's breadcrumb buffer, made through XCL'sCreatePlacedResourcehook and released through the debug layer's object) before the command list.On the
out == objbranch: we had made the same change on our side, but without that branch. Yours is better: inreadoptthe object already carries XCL's extended table, and its slot 2 is XCL'sReleaseoverride (cl_releaseand the like), not the native one.If you want the GPU check in the PR, here it is (
crates/xcl/tests/debug_layer_dred.rs). It skips without a GPU or without the debug layer (Graphics Tools):Not tested
6020a33+ this PR, with or without the debug layer.readoptpath (DMA lists) under the debug layer.AI use: omp with Claude Opus 5.5 ran the tests above on the machine named, wrote the GPU check and this report; no code changes to this PR.
Imported from ivall/xcl. Originally posted by jessenic on 2026-11-25T09:05:10Z.
Test report: this PR fixes the start-up crash with
XCL_DRED=1andXCL_D3D12_DEBUG=1together on an RTX 5070 Ti too. Under a debugger, the crash without it is the path this PR changes.Setup: RTX 5070 Ti 16 GB (driver 610.88), Ryzen 7 9700X, Windows 11 Pro 26300, rustc 1.97.0, release. A retail title, on a local integration branch based on
main8f5fca5. This PR's256b3f2was cherry-picked on top cleanly.0xc0000005inD3D12Core.dll+0x6047b(a read at 0x0), at the title's firstCreateCommandListX. cdb (-o, D3D12 symbols from the Microsoft symbol server) gives this stack, outermost call at the bottom: With DRED on, D3D12Core makes each list's breadcrumb buffer through the hookedCreatePlacedResource.class_forthen probes the new object and callsReleasethrough the original object's vtable on the interface QueryInterface returned, as the PR description says. The same build withoutXCL_D3D12_DEBUGstarted normally.cargo test -p xcl --lib -- class_probe sparseon this tree: 23 passed, 0 failed, 1 ignored, includingclass_probe_releases_the_queried_interface.Not tested:
mainalone; AMD; the full suite on this tree; not ascripts/smoke.ps1regression run.AI use: Claude Code (Claude Opus 5.5) ran the runs and cdb on the machine above and wrote this report.
upstream-sync referenced this pull request2026-11-25 11:07:09 +00:00
Imported from ivall/xcl. Originally posted by Swagi-REDACTED on 2026-11-25T11:15:42Z.
NVIDIA startup validation of this fix, encountered while diagnosing A newer retail game.
Hardware: Ryzen 7 9800X3D, RTX 3060 12 GB (621.14), approximately 16 GB RAM, Windows 11 Home 26200; Rust 1.95.0 MSVC, DXC/DXIL 1.9.2602.17.
Before: local integration
cd3719f313a38e25fd45cf593145683a2922599a(#2057 reference plus #2046 and #541). WithXCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_DRED=1 XCL_D3D12_DEBUG=1 XCL_PSO_TRACE=1 XCL_COHERENT_MB=4095 XCL_NETWORK=0,xcl run <owned-title-folder>ended during startup with0xc0000005, a null read in D3D12Core. Symbolicating the matching XCL/PDB locatedreal::class_forandreal::dev_create_placed_resourceon the stack.After: cherry-picked only
256b3f2929e58a466b51ae8ca4fa6dcffabdbe14as local head46ce479. The same configuration passes that startup point, adopts both native and debug-layer resource interfaces, visibly reaches profile selection, and advances into loading. It subsequently ended during world setup with a GPU hang (0x887a0006) and the title's error breakpoint. The startup access violation did not recur. Resource-state/command-list validation errors and a separate mesh-pipeline rejection remain; this does not establish world rendering or prologue completion.Validation on the integrated tree:
cargo test --locked -p xcl --lib class_probe_releases_the_queried_interface -- --test-threads=1: 1 passed, 0 failed, 0 ignored; no explicit skips.cargo test --locked --workspace -- --test-threads=4, direct/heap/shadow off: 1,202 passed, 0 failed, 46 ignored, 21 result blocks; 25 explicit skip events (20 native-wave64, 3 unsupported per-lane f16, 1 heap-window-disabled case, 1 PSO measurement requiring Developer Mode).cargo test --locked -p xcl --lib gpu_ -- --test-threads=4, direct/heap/shadow on: 143 passed, 0 failed, 1 ignored; two native-wave64 skip events.cargo build --locked --release --workspace: passed, 46.34 s.This is not a clean main/PR-head smoke pair. Both sides also contained the same optional local input harness and a wrapping-arithmetic correction in the reference branch's texture-upload test-data generator. No assertions were weakened. No game data, dumps or screenshots are attached.
AI use: Codex, GPT-6 (exact serving variant not exposed), investigated the failure, integrated the existing patch, ran these commands and wrote this report. The interface fix remains its original author's work.
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-26T20:26:17Z.
Independent RTX 5070 DRED result, on a local integration of this patch with newer main (not the standalone PR head).
8b957bec6f82495aec940944c6bf47faa02db590:test_title_runs_under_the_debug_layer_with_dredfailed twice, once during the full workspace suite and once isolated. In the captured run the synthetic title completed triangle readback, then exited0xC0000005during the presentation test; its crash stack included XCL'sclass_forand D3D12Core. The ordinary debug-layer test passed on baseline. A stack scan is not by itself proof of the root cause.256b3f2929e58a466b51ae8ca4fa6dcffabdbe14to that main revision and built the workspace.cargo test --locked -p xcl --test e2e test_title_runs_under_the_debug_layer_with_dred -- --exact --nocapturepassed in 4 independent invocations, each 1 passed, 0 failed, 0 ignored, no reported skips. This comparison supports the patch's relevance to the crash, but does not establish the precise root cause.Not tested: the standalone PR head, full suite on the integration, a retail title, or other GPUs.
AI use: OpenAI Codex with GPT-6.2 Astra investigated and ran the patched tests; Codex ran the isolated baseline and coordinated this report.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T10:59:07Z.
Independent desktop NVIDIA verification of PR #1156 at head
256b3f2929e58a466b51ae8ca4fa6dcffabdbe14(1commit; exact parent & merge-base:47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
256b3f29)cargo test --release -p xcl --lib class_probe_releases_the_queried_interface -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 719 filtered out× 3 (0.00s,0.00s,0.00s,0skipped)cargo test --release -p xcl --lib hle::d3d12x::real:: -- --nocapture(3 consecutive runs)19 passed; 0 failed; 0 ignored; 701 filtered out× 3 (0.21s,0.19s,0.19s,0skipped)cargo build --release -p xcl1m 04s, exit0,0new warnings inreal.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1at47efa2ecpredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
47efa2ecea0a12934719ae69b81930cf02a4b1c3, cached baseline on the same machine):PR #1156 (
256b3f2929e58a466b51ae8ca4fa6dcffabdbe14):Limits of coverage
class_probe_releases_the_queried_interfaceand the fullhle::d3d12x::real::suite (19/19,0skipped) passed3/3, directly verifying thatQueryInterfaceprobes release the returned interface pointer rather than the source pointer.0device removals,0crashes, steady 60 Hz); single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:56:28Z.
Triage (#1607) – head
256b3f2The fix is on main: commit
182f8c23("D3D12.X: the interface probe releases what QueryInterface gave through its own vtable") changed class_for in real.rs to call release_through_its_own_vtable(out), which is the same as this PR's vt(out) path (the out == obj branch is equivalent, since the vtable is the same object's).What main lacks is the class_probe_tests unit test; that could go in a small test-only PR on top of main. The README line about XCL_DRED is unrelated to the fix and main already documents XCL_DRED.
Recommendation: close (superseded by main commit
182f8c23).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:43:13Z.
Closing as superseded: this change is already on
main(182f8c23). main class_for releases the QueryInterface result via release_through_its_own_vtable; README XCL_DRED line is on main (line ~406)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed