D3D12.X: release the interface returned by QueryInterface #1147

Closed
gloger2003 wants to merge 1 commit from upstream-pr/1156 into main
gloger2003 commented 2026-11-24 12:37:43 +00:00 (Migrated from github.com)

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

  • Dispatch Release through the returned interface while keeping native dispatch when querying the same object.
  • Verify the call using two distinct interface tables.

Tested

  • Windows 11 26300.9974, RX 7800 XT (32.0.32029.2010), Ryzen 7 5700X, Rust 1.100.0 MSVC and DXC 1.9.2602.17.
  • The focused test failed before the change and passed after it. Workspace build and four-thread suite: 742 passed, 0 failed, 41 ignored, no explicit GPU capability skips.
  • With DRED and the D3D12 debug layer both enabled and identical 1x game settings, the baseline ended at startup. This exact head ran for 20 seconds, rendered 1,029 frames and exited cleanly. Resource-state warnings remain.

Regression run
Minecraft Preview 1.18.3064.0, normal D3D12 mode with identical 1x game profiles.

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 7800 XT
title: Xbox-Series-1.18.3064.0
seconds: 60
exit: 0x0
frames shown: 3463 (PresentX 3463)
presents per 2 s (last 3): 120 120 120
device removals: 0
crashes: 0
peak commit: 3342 MB

PR:

xcl-smoke v1
commit: 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14
gpu: AMD Radeon RX 7800 XT
title: Xbox-Series-1.18.3064.0
seconds: 60
exit: 0x0
frames shown: 3469 (PresentX 3469)
presents per 2 s (last 3): 120 120 121
device removals: 0
crashes: 0
peak commit: 3359 MB

Not tested

  • Other GPU vendors, gameplay beyond the menu, and tests requiring external XCL_SAMPLE_* files.

AI use

  • OpenAI Codex (GPT-6, exact variant unavailable) investigated the startup, implemented the change and regression test, ran the tests, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5472288323 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156). Originally posted by [gloger2003](https://github.com/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** - Dispatch Release through the returned interface while keeping native dispatch when querying the same object. - Verify the call using two distinct interface tables. **Tested** - Windows 11 26300.9974, RX 7800 XT (32.0.32029.2010), Ryzen 7 5700X, Rust 1.100.0 MSVC and DXC 1.9.2602.17. - The focused test failed before the change and passed after it. Workspace build and four-thread suite: 742 passed, 0 failed, 41 ignored, no explicit GPU capability skips. - With DRED and the D3D12 debug layer both enabled and identical 1x game settings, the baseline ended at startup. This exact head ran for 20 seconds, rendered 1,029 frames and exited cleanly. Resource-state warnings remain. **Regression run** Minecraft Preview 1.18.3064.0, normal D3D12 mode with identical 1x game profiles. main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 7800 XT title: Xbox-Series-1.18.3064.0 seconds: 60 exit: 0x0 frames shown: 3463 (PresentX 3463) presents per 2 s (last 3): 120 120 120 device removals: 0 crashes: 0 peak commit: 3342 MB ``` PR: ``` xcl-smoke v1 commit: 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14 gpu: AMD Radeon RX 7800 XT title: Xbox-Series-1.18.3064.0 seconds: 60 exit: 0x0 frames shown: 3469 (PresentX 3469) presents per 2 s (last 3): 120 120 121 device removals: 0 crashes: 0 peak commit: 3359 MB ``` **Not tested** - Other GPU vendors, gameplay beyond the menu, and tests requiring external XCL_SAMPLE_* files. **AI use** - OpenAI Codex (GPT-6, exact variant unavailable) investigated the startup, implemented the change and regression test, ran the tests, and drafted this description.
DavidM1911 commented 2026-11-24 13:03:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:48:06Z.


Independent verification on current main 384f7f7 (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.
  • The change releases the extra reference on the interface returned by QueryInterface when the caller's contract doesn't need it — matches the README note; refcount tests in gameinput::tests::query_interface_validates_iids_and_refcounts also pass.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

<!-- greyfinch-sync:ivall/xcl:comment:7131936825 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1156#issuecomment-7131936825). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T12:48:06Z. --- Independent verification on current `main` `384f7f7` (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. - The change releases the extra reference on the interface returned by `QueryInterface` when the caller's contract doesn't need it — matches the README note; refcount tests in `gameinput::tests::query_interface_validates_iids_and_refcounts` also pass. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
JoaoPauluu commented 2026-11-24 15:05:50 +00:00 (Migrated from github.com)

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

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 256b3f2 as it is (merge base 47efa2e) and main 47efa2e, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Twelve runs in a row, main first and last, other PRs in between.
  • A regression check: I did not check whether GTA VI reaches the changed code in these 60 s.

Regression run

main (first run):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1384 (PresentX 1384)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1393 (PresentX 1393)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1425 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7134243176 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1156#issuecomment-7134243176). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T14:21:30Z. --- A regression run under Wine on Linux, on a retail title. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `256b3f2` as it is (merge base `47efa2e`) and `main` `47efa2e`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Twelve runs in a row, `main` first and last, other PRs in between. - A regression check: I did not check whether GTA VI reaches the changed code in these 60 s. **Regression run** main (first run): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1384 (PresentX 1384) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1393 (PresentX 1393) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The last `main` run: 1425 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head; native Windows; AMD. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
wondercrash commented 2026-11-25 06:06:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by wondercrash on 2026-11-25T05:54:24Z.


Tested on main 6020a33 + this PR (256b3f2 cherry-picked; same tree as the merge). With the D3D12 debug layer and DRED both on, main crashes at the first CreateCommandList, and this PR fixes it. Your unit test fails on main and 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.dll and d3d12SDKLayers.dll 10.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=4 on 6020a33 + 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..3 fail with CreateComputePipelineState: ... (0x8007000E) (seeds 70, 545, 1019, 1507). The same four fail the same way on plain 6020a33, 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") and kernelx::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 on 6020a33.
    • SKIPPED (24): 20 no wave64 (gpu::recomp::lower, lower_dxil, recomp::tests), 3 lower_dxil per-lane f16 forms refused (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32, #1426), and heap_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 to 6020a33): fails on main at real.rs:6578 and passes with the fix.
  • GPU check with the real debug layer and DRED, from a scratch integration test (below): XCL_D3D12_DEBUG=1 + XCL_DRED=1, D3D12.X real backend, then CreateCommandAllocator, CreateCommandList, Close, Reset and Close again.
    • 6020a33: the test process ends with 0xc0000005 STATUS_ACCESS_VIOLATION right after XCL wraps the command allocator, during CreateCommandList.
    • This PR: it passes. The log shows XCL adopting an ID3D12Resource2 with PC vtable D3D12Core.dll+0x14c238 (DRED's breadcrumb buffer, made through XCL's CreatePlacedResource hook and released through the debug layer's object) before the command list.

On the out == obj branch: we had made the same change on our side, but without that branch. Yours is better: in readopt the object already carries XCL's extended table, and its slot 2 is XCL's Release override (cl_release and 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):

//! The D3D12 debug layer (`XCL_D3D12_DEBUG=1`) with DRED (`XCL_DRED=1`): making a command list,
//! the runtime makes DRED's breadcrumb buffer through the device's CreatePlacedResource – XCL's
//! hook – and gets back its own inner resource, which XCL adopts. Its QueryInterface answers
//! with the debug layer's object, which must be released through its own vtable.

use windows::core::Interface;
use windows::Win32::Graphics::Direct3D12::*;

use xcl::gpu::recomp::runner;
use xcl::hle::d3d12x::real;

#[test]
fn command_list_with_debug_layer_and_dred() {
    std::env::set_var("XCL_UMA_MB", "64");
    std::env::set_var("XCL_D3D12_DEBUG", "1");
    std::env::set_var("XCL_DRED", "1");
    if xcl::hle::d3d12x::backend() != xcl::hle::d3d12x::Backend::Real {
        return runner::skip_test("no GPU");
    }
    let raw = real::device_raw();
    let dev = unsafe { ID3D12Device::from_raw_borrowed(&raw) }.expect("backend device").clone();
    if dev.cast::<ID3D12InfoQueue>().is_err() {
        return runner::skip_test("no D3D12 debug layer (Graphics Tools)");
    }
    unsafe {
        let alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT).expect("allocator");
        let list: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &alloc, None).expect("command list");
        list.Close().expect("Close");
        alloc.Reset().expect("allocator Reset");
        list.Reset(&alloc, None).expect("list Reset");
        list.Close().expect("second Close");
    }
}

Not tested

  • A title run (smoke) on 6020a33 + this PR, with or without the debug layer.
  • The Agility SDK debug layer, AMD, Wine.
  • The readopt path (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.

<!-- greyfinch-sync:ivall/xcl:comment:7154251428 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7154251428). Originally posted by [wondercrash](https://github.com/wondercrash) on 2026-11-25T05:54:24Z. --- Tested on `main` `6020a33` + this PR (`256b3f2` cherry-picked; same tree as the merge). With the D3D12 debug layer and DRED both on, `main` crashes at the first `CreateCommandList`, and this PR fixes it. Your unit test fails on `main` and 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.dll` and `d3d12SDKLayers.dll` 10.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=4` on `6020a33` + 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..3` fail with `CreateComputePipelineState: ... (0x8007000E)` (seeds 70, 545, 1019, 1507). The same four fail the same way on plain `6020a33`, 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") and `kernelx::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 on `6020a33`. - SKIPPED (24): 20 `no wave64` (`gpu::recomp::lower`, `lower_dxil`, `recomp::tests`), 3 `lower_dxil` per-lane f16 forms refused (`V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`, #1426), and `heap_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 to `6020a33`): fails on `main` at `real.rs:6578` and passes with the fix. - GPU check with the real debug layer and DRED, from a scratch integration test (below): `XCL_D3D12_DEBUG=1` + `XCL_DRED=1`, D3D12.X real backend, then `CreateCommandAllocator`, `CreateCommandList`, `Close`, `Reset` and `Close` again. - `6020a33`: the test process ends with `0xc0000005 STATUS_ACCESS_VIOLATION` right after XCL wraps the command allocator, during `CreateCommandList`. - This PR: it passes. The log shows XCL adopting an `ID3D12Resource2` with `PC vtable D3D12Core.dll+0x14c238` (DRED's breadcrumb buffer, made through XCL's `CreatePlacedResource` hook and released through the debug layer's object) before the command list. On the `out == obj` branch: we had made the same change on our side, but without that branch. Yours is better: in `readopt` the object already carries XCL's extended table, and its slot 2 is XCL's `Release` override (`cl_release` and 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): ```rust //! The D3D12 debug layer (`XCL_D3D12_DEBUG=1`) with DRED (`XCL_DRED=1`): making a command list, //! the runtime makes DRED's breadcrumb buffer through the device's CreatePlacedResource – XCL's //! hook – and gets back its own inner resource, which XCL adopts. Its QueryInterface answers //! with the debug layer's object, which must be released through its own vtable. use windows::core::Interface; use windows::Win32::Graphics::Direct3D12::*; use xcl::gpu::recomp::runner; use xcl::hle::d3d12x::real; #[test] fn command_list_with_debug_layer_and_dred() { std::env::set_var("XCL_UMA_MB", "64"); std::env::set_var("XCL_D3D12_DEBUG", "1"); std::env::set_var("XCL_DRED", "1"); if xcl::hle::d3d12x::backend() != xcl::hle::d3d12x::Backend::Real { return runner::skip_test("no GPU"); } let raw = real::device_raw(); let dev = unsafe { ID3D12Device::from_raw_borrowed(&raw) }.expect("backend device").clone(); if dev.cast::<ID3D12InfoQueue>().is_err() { return runner::skip_test("no D3D12 debug layer (Graphics Tools)"); } unsafe { let alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT).expect("allocator"); let list: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &alloc, None).expect("command list"); list.Close().expect("Close"); alloc.Reset().expect("allocator Reset"); list.Reset(&alloc, None).expect("list Reset"); list.Close().expect("second Close"); } } ``` **Not tested** - A title run (smoke) on `6020a33` + this PR, with or without the debug layer. - The Agility SDK debug layer, AMD, Wine. - The `readopt` path (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.
jessenic commented 2026-11-25 09:08:25 +00:00 (Migrated from github.com)

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=1 and XCL_D3D12_DEBUG=1 together 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 main 8f5fca5. This PR's 256b3f2 was cherry-picked on top cleanly.

  • Without this PR: 2 of 2 runs crashed at 3.9 s with 0xc0000005 in D3D12Core.dll+0x6047b (a read at 0x0), at the title's first CreateCommandListX. cdb (-o, D3D12 symbols from the Microsoft symbol server) gives this stack, outermost call at the bottom:
    D3D12Core!CLayeredObject<CBackingCommandAllocator>::CContainedObject::Release+0xb
    xcl!xcl::hle::d3d12x::real::class_for+0x1e5
    xcl!xcl::hle::d3d12x::real::dev_create_placed_resource+0x53f
    D3D12Core!Dred::CBreadcrumbBuffer::CBreadcrumbBuffer+0x1f3
    D3D12Core!CDevice::AllocateBreadcrumbBuffer+0x3f3
    D3D12Core!CGraphicsCommandList::FinalConstruct+0x153
    ...
    D3D12SDKLayers!NDebug::CDevice::CreateCommandList+0xeb
    xcl!xcl::hle::d3d12x::real::dev_create_command_list+0x96
    xcl!xcl::hle::d3d12x::device_x::create_command_list_x+0x49
    
    With DRED on, D3D12Core makes each list's breadcrumb buffer through the hooked CreatePlacedResource. class_for then probes the new object and calls Release through the original object's vtable on the interface QueryInterface returned, as the PR description says. The same build without XCL_D3D12_DEBUG started normally.
  • With this PR: the same setup (DRED and the debug layer both on) started and ran 158 s into the world. It ended at a device removal this title also has without DRED or the debug layer (#505), not at start-up.
  • cargo test -p xcl --lib -- class_probe sparse on this tree: 23 passed, 0 failed, 1 ignored, including class_probe_releases_the_queried_interface.

Not tested: main alone; AMD; the full suite on this tree; not a scripts/smoke.ps1 regression run.

AI use: Claude Code (Claude Opus 5.5) ran the runs and cdb on the machine above and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7157854576 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7157854576). Originally posted by [jessenic](https://github.com/jessenic) on 2026-11-25T09:05:10Z. --- **Test report: this PR fixes the start-up crash with `XCL_DRED=1` and `XCL_D3D12_DEBUG=1` together 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 `main` `8f5fca5`. This PR's `256b3f2` was cherry-picked on top cleanly. - **Without this PR:** 2 of 2 runs crashed at 3.9 s with `0xc0000005` in `D3D12Core.dll+0x6047b` (a read at 0x0), at the title's first `CreateCommandListX`. cdb (`-o`, D3D12 symbols from the Microsoft symbol server) gives this stack, outermost call at the bottom: ``` D3D12Core!CLayeredObject<CBackingCommandAllocator>::CContainedObject::Release+0xb xcl!xcl::hle::d3d12x::real::class_for+0x1e5 xcl!xcl::hle::d3d12x::real::dev_create_placed_resource+0x53f D3D12Core!Dred::CBreadcrumbBuffer::CBreadcrumbBuffer+0x1f3 D3D12Core!CDevice::AllocateBreadcrumbBuffer+0x3f3 D3D12Core!CGraphicsCommandList::FinalConstruct+0x153 ... D3D12SDKLayers!NDebug::CDevice::CreateCommandList+0xeb xcl!xcl::hle::d3d12x::real::dev_create_command_list+0x96 xcl!xcl::hle::d3d12x::device_x::create_command_list_x+0x49 ``` With DRED on, D3D12Core makes each list's breadcrumb buffer through the hooked `CreatePlacedResource`. `class_for` then probes the new object and calls `Release` through the original object's vtable on the interface QueryInterface returned, as the PR description says. The same build without `XCL_D3D12_DEBUG` started normally. - **With this PR:** the same setup (DRED and the debug layer both on) started and ran 158 s into the world. It ended at a device removal this title also has without DRED or the debug layer (#505), not at start-up. - `cargo test -p xcl --lib -- class_probe sparse` on this tree: 23 passed, 0 failed, 1 ignored, including `class_probe_releases_the_queried_interface`. **Not tested:** `main` alone; AMD; the full suite on this tree; not a `scripts/smoke.ps1` regression run. **AI use:** Claude Code (Claude Opus 5.5) ran the runs and cdb on the machine above and wrote this report.
Swagi-REDACTED commented 2026-11-25 12:06:23 +00:00 (Migrated from github.com)

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). With XCL_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 with 0xc0000005, a null read in D3D12Core. Symbolicating the matching XCL/PDB located real::class_for and real::dev_create_placed_resource on the stack.

After: cherry-picked only 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14 as local head 46ce479. 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.

<!-- greyfinch-sync:ivall/xcl:comment:7160810480 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7160810480). Originally posted by [Swagi-REDACTED](https://github.com/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). With `XCL_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 with `0xc0000005`, a null read in D3D12Core. Symbolicating the matching XCL/PDB located `real::class_for` and `real::dev_create_placed_resource` on the stack. After: cherry-picked only `256b3f2929e58a466b51ae8ca4fa6dcffabdbe14` as local head `46ce479`. 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.
andrewDoing commented 2026-11-26 20:26:17 +00:00 (Migrated from github.com)

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).

  • NVIDIA RTX 5070, driver 616.92; Ryzen 7 5700X3D; Windows build 26300.10075; D3D12Core and SDKLayers 10.0.26100.10068; Rust 1.100.0 MSVC, debug; DXC/DXIL 1.8.2502.11.
  • Clean main 8b957bec6f82495aec940944c6bf47faa02db590: test_title_runs_under_the_debug_layer_with_dred failed twice, once during the full workspace suite and once isolated. In the captured run the synthetic title completed triangle readback, then exited 0xC0000005 during the presentation test; its crash stack included XCL's class_for and D3D12Core. The ordinary debug-layer test passed on baseline. A stack scan is not by itself proof of the root cause.
  • Applied the unchanged patch from PR head 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14 to that main revision and built the workspace. cargo test --locked -p xcl --test e2e test_title_runs_under_the_debug_layer_with_dred -- --exact --nocapture passed 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.

<!-- greyfinch-sync:ivall/xcl:comment:7202680107 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7202680107). Originally posted by [andrewDoing](https://github.com/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). - NVIDIA RTX 5070, driver 616.92; Ryzen 7 5700X3D; Windows build 26300.10075; D3D12Core and SDKLayers 10.0.26100.10068; Rust 1.100.0 MSVC, debug; DXC/DXIL 1.8.2502.11. - Clean main `8b957bec6f82495aec940944c6bf47faa02db590`: `test_title_runs_under_the_debug_layer_with_dred` failed twice, once during the full workspace suite and once isolated. In the captured run the synthetic title completed triangle readback, then exited `0xC0000005` during the presentation test; its crash stack included XCL's `class_for` and D3D12Core. The ordinary debug-layer test passed on baseline. A stack scan is not by itself proof of the root cause. - Applied the unchanged patch from PR head `256b3f2929e58a466b51ae8ca4fa6dcffabdbe14` to that main revision and built the workspace. `cargo test --locked -p xcl --test e2e test_title_runs_under_the_debug_layer_with_dred -- --exact --nocapture` passed 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.
Decodere commented 2026-11-27 10:59:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T10:59:07Z.


Independent desktop NVIDIA verification of PR #1156 at head 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14 (1 commit; exact parent & merge-base: 47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted tests & build (256b3f29)

Command Result
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, 0 skipped)
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, 0 skipped)
cargo build --release -p xcl Clean build (1m 04s, exit 0, 0 new warnings in real.rs)

Paired quiet 60 s retail smoke (title: 29640639)

(Note: scripts/smoke.ps1 at 47efa2ec predates 9683e7a6 and printed the local folder basename on title:; replaced below with the standard 9683e7a6 title hash 29640639, with all measured fields verbatim.)

Exact parent & merge-base (47efa2ecea0a12934719ae69b81930cf02a4b1c3, cached baseline on the same machine):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1527 (PresentX 1527)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14723 MB

PR #1156 (256b3f2929e58a466b51ae8ca4fa6dcffabdbe14):

xcl-smoke v1
commit: 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1557 (PresentX 1557)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14718 MB

Limits of coverage

  • class_probe_releases_the_queried_interface and the full hle::d3d12x::real:: suite (19/19, 0 skipped) passed 3/3, directly verifying that QueryInterface probes release the returned interface pointer rather than the source pointer.
  • The 60 s retail smoke confirms live D3D12.X interface probing and runtime stability on desktop RTX 4060 (0 device removals, 0 crashes, 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).

<!-- greyfinch-sync:ivall/xcl:comment:7216541579 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7216541579). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T10:59:07Z. --- Independent desktop NVIDIA verification of **PR #1156** at head `256b3f2929e58a466b51ae8ca4fa6dcffabdbe14` (`1` commit; exact parent & merge-base: `47efa2ecea0a12934719ae69b81930cf02a4b1c3`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted tests & build (`256b3f29`) | Command | Result | | --- | --- | | `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`, `0` skipped) | | `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`, `0` skipped) | | `cargo build --release -p xcl` | Clean build (`1m 04s`, exit `0`, `0` new warnings in `real.rs`) | ### Paired quiet 60 s retail smoke (`title: 29640639`) *(Note: `scripts/smoke.ps1` at `47efa2ec` predates `9683e7a6` and printed the local folder basename on `title:`; replaced below with the standard `9683e7a6` title hash `29640639`, with all measured fields verbatim.)* Exact parent & merge-base (`47efa2ecea0a12934719ae69b81930cf02a4b1c3`, cached baseline on the same machine): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1527 (PresentX 1527) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14723 MB ``` PR #1156 (`256b3f2929e58a466b51ae8ca4fa6dcffabdbe14`): ``` xcl-smoke v1 commit: 256b3f2929e58a466b51ae8ca4fa6dcffabdbe14 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1557 (PresentX 1557) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14718 MB ``` ### Limits of coverage - `class_probe_releases_the_queried_interface` and the full `hle::d3d12x::real::` suite (`19/19`, `0` skipped) passed `3/3`, directly verifying that `QueryInterface` probes release the returned interface pointer rather than the source pointer. - The 60 s retail smoke confirms live D3D12.X interface probing and runtime stability on desktop RTX 4060 (`0` device removals, `0` crashes, 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).*
Foniass commented 2026-12-01 04:56:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:56:28Z.


Triage (#1607) – head 256b3f2

The 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.

<!-- greyfinch-sync:ivall/xcl:comment:7301257917 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7301257917). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:56:28Z. --- **Triage (#1607)** – head 256b3f2 The 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.
throny commented 2026-12-01 12:43:13 +00:00 (Migrated from github.com)

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 on main, 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.

<!-- greyfinch-sync:ivall/xcl:comment:7311547719 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1156#issuecomment-7311547719). Originally posted by [throny](https://github.com/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 on `main`, 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1147
No description provided.