D3D12.X: debug layer messages reach the log without ID3D12InfoQueue1 #1001
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1008"
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 madaraXor on 2026-11-24T10:20:23Z.
With
XCL_D3D12_DEBUG=1, the debug layer's messages reachedxcl.logonly through anID3D12InfoQueue1message callback. Windows 10 has noID3D12InfoQueue1: the cast fails withE_NOINTERFACE(measured on 19045 with the Agility SDK 1.620.2), the failure was ignored, and the log got no message at all. The debug layer was on but silent there, andtest_title_draws_with_a_root_signature_under_the_debug_layerpassed without seeing a single message.Without
ID3D12InfoQueue1, XCL now keeps the device'sID3D12InfoQueue, logs its stored messages with the same caps (8 per id, 3 000 in all) and clears it, at every submission and present (stop_if_device_removed). The messages that led to a device removal are logged before the removal. WithID3D12InfoQueue1nothing changes.What is in it
crates/xcl/src/hle/d3d12x/real.rs: the fallback toID3D12InfoQueue(poll_debug_messages, called first instop_if_device_removed). The callback and the poll sharelog_debug_message.crates/xcl/tests/debug_layer_log.rs(its own process): adds an application message to the debug layer's queue and expects it in the log afterstop_if_device_removed. Skipped without the debug layer.Tested
stable-x86_64-pc-windows-msvc; DXC 1.8.2502.11; tests in debug, runs in release.cargo test --workspace --no-fail-fast -- --test-threads=4on8dde8ff: 713 passed, 4 failed, 41 ignored, noSKIPPED. The same 4 fail onmain09940bb(712 passed, 4 failed, 41 ignored):xmem_virtual_query_marks_cpu_readable_memory(misaligned output buffer, #650 / #656) andplaced_title_textures_share_vram_and_preserve_pixelswith the two tests on its poisoned lock (#718, #447).cargo test -p xcl --test debug_layer_log: fails onmain(the message is not in the log), passes here.test_title_draws_with_a_root_signature_under_the_debug_layer: passes on both. Onmainthe test title's log has 0 debug layer messages, here 22 (none about a missing root signature).XCL_D3D12_DEBUG=1andXCL_NETWORK=0: 53 debug layer messages in 30 s here (20 errors, ids 538, 1047, 824, 723, 1422); none in a 35 s run onmain.Regression run
main:This PR:
The smoke runs do not turn the debug layer on: without it the new code is a lock on an empty slot.
Not tested
ID3D12InfoQueue1(Windows 11): the callback path is unchanged, but the new test was not run there (it should pass through the callback).AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T11:22:45Z.
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti + Radeon iGPU; Rust stable MSVC, debug.
cargo test -p xcl --test debug_layer_log: 1 passed —debug_layer_messages_reach_the_log(the new integration test).AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by jmal423 on 2026-11-24T11:31:52Z.
Windows 11 callback timing and per-ID cap on head
8dde8ff, RX 9070 XT (32.0.32029.2010), Windows Graphics Tools installed. I extended the integration test locally: required ID3D12InfoQueue1 on the real device, added the same application error 12 times, flushed the XCL log before the first stop_if_device_removed call, then called it twice and flushed again. Matching log lines: 8 before either call, 8 after both. This verifies immediate callback delivery and the 8-per-ID cap on this setup. The cap could also suppress duplicates, so the final count alone cannot establish whether polling was internally attempted. The Windows 10 fallback and concurrent writers were outside this test. AI use: Codex wrote and ran the scratch test and prepared this report.Follow-up below the per-ID cap: I injected three identical application errors in fresh processes using the same scratch binary. Matching log lines before polling / after one poll / after a second poll: native callback 3/3/3; forced fallback 0/3/3. The only runtime instrumentation was a short-circuit around callback registration; the device, queue and polling implementation were real. This verifies deferred delivery and no duplicate on a second empty poll in this single-writer Windows 11 test. It does not simulate concurrent insertion or Windows 10 interface discovery.
Concurrent-writer measurement on the forced polling path (same Windows 11 setup): seven distinct text markers sharing one application message ID, below the cap of eight. Each AddApplicationMessage succeeded. In 12 fresh processes where the poller waited for the writer to finish, the log retained 84/84 markers. In 12 fresh processes where the poller called stop_if_device_removed in a tight loop alongside the writer, followed by a final poll after join, it retained 35/84 (per trial: 1,1,1,1,1,7,5,4,1,7,5,1). This measures the snapshot/clear limitation already disclosed in the PR under synthetic contention; it is not an estimate of retail message loss. No game files or device removal involved.
Reproducer patch for
8dde8ff(test instrumentation only)Save the diff as queue.patch and run the following in PowerShell from the repository root. Change the adapter selector for other hardware. Run each mode in fresh processes several times because the concurrent case can pass. Count a run only if it prints observed=N/7. Without a real GPU backend or debug queue this integration test can return early and Cargo can still report success. The sequential control should print observed=7/7.
Imported from ivall/xcl. Originally posted by SergeAx on 2026-11-26T16:00:30Z.
Test report on NVIDIA / Windows 10: this works. The test fails without it and passes with it, and a retail run logs 80 debug layer messages where the same build without it logs none. Tested commit: this PR's head
8dde8ff, merged ontomainb49be18+ #1435 (14c8a2d; the title needs it to get past 98 s, #662). Merge07380b8, no conflicts.Setup:
d3d12SDKLayers.dll; tests in debug, the title in release.Tested:
cargo test -p xcl --test debug_layer_log: 1 passed on the merge. Onmainb49be18+ #1435 with only this test file added, it fails at the assertion that the message is in the log.E_NOINTERFACEforID3D12InfoQueue1from the Agility SDK device, whileID3D12InfoQueuestored the messages.XCL_D3D12_DEBUG=1 XCL_DRED=1 XCL_NETWORK=0, presses scripted withXCL_PRESS_A_AT:D3D12: no ID3D12InfoQueue1 – the debug layer's messages are read at every submission and present.UpdateTileMappings/ExecuteCommandListson a resource another queue still writes) and 1422.XCL_D3D12_DEBUG=1on the same build without this PR,xcl.logsaidD3D12: debug layer enabledand then had none of the layer's messages. A DBWIN (OutputDebugString) listener showed the layer was producing them (#1452).One thing to know for device removals: this run ended in #1452's removal at 138.0 s, but the last debug layer line in the log is from 126.7 s.
#234 DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT) has the severity MESSAGE, whichlog_debug_messagedrops (asdebug_messagedid before).Not tested:
AI use: Claude Code (Claude Opus 5.5) ran the tests and the unattended title run, read the logs and wrote this report.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:39:04Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:37:35Z.
Triage (#1607) – head
8dde8ffNo open or merged PR adds the
ID3D12InfoQueuepolling fallback; main still registers the debug-layer callback throughID3D12InfoQueue1only.tests/debug_layer_log.rs: on a system that hasID3D12InfoQueue1(Windows 11) the message reaches the log through the callback, so the test passes without the newpoll_debug_messagespath. Only a Windows 10 run exercises the fix, so please say in the PR which one you ran it on.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.