From dbe932400410828fd0490f86714a1f397d4a1504 Mon Sep 17 00:00:00 2001 From: theaustinayers <153482135+theaustinayers@users.noreply.github.com> Date: Tue, 24 Nov 2026 02:07:02 -0500 Subject: [PATCH] D3D12.X: name XCL's own tile-mapping lists and say when a wait for a queue gives up Diagnostics for a queue that stands still. With the debug layer on, a retail title's device was removed with "The command allocator was reset after the command list was recorded" (id 541) on an 'Unnamed ID3D12GraphicsCommandList Object': the title's list or one of XCL's could not be told apart. XCL's tile-mapping queue, its upload lists and its readback list now carry names. Two waits end after a time limit and carry on without a word: the tile-mapping queue's wait for its own fence (5 s), and the wait of the writes after the GPU for their queue (10 s; the title then reads a progress value its queue has not reached). Both now log a warning. Assisted-by: Claude Code (Claude Fable 5.2) --- crates/xcl/src/hle/d3d12x/cpu_writes.rs | 7 +++++++ crates/xcl/src/hle/d3d12x/sparse.rs | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/crates/xcl/src/hle/d3d12x/cpu_writes.rs b/crates/xcl/src/hle/d3d12x/cpu_writes.rs index eb52006509..eeb524893f 100644 --- a/crates/xcl/src/hle/d3d12x/cpu_writes.rs +++ b/crates/xcl/src/hle/d3d12x/cpu_writes.rs @@ -62,6 +62,13 @@ fn worker() -> &'static Mutex> { for job in rx { if job.fence.GetCompletedValue() < job.value && job.fence.SetEventOnCompletion(job.value, HANDLE(event as *mut c_void)).is_ok() { th::WaitForSingleObject(event, WAIT_MS); + if job.fence.GetCompletedValue() < job.value { + static LATE: AtomicU64 = AtomicU64::new(0); + let k = LATE.fetch_add(1, Ordering::Relaxed) + 1; + if k.is_power_of_two() { + crate::xlog_warn!("D3D12.X: {k} writes after the GPU so far done although their queue had not got there after {WAIT_MS} ms (fence at {}, wanted {}; {} writes)", job.fence.GetCompletedValue(), job.value, job.writes.len()); + } + } } for w in &job.writes { match w { diff --git a/crates/xcl/src/hle/d3d12x/sparse.rs b/crates/xcl/src/hle/d3d12x/sparse.rs index 18c2ede5ea..891fc19466 100644 --- a/crates/xcl/src/hle/d3d12x/sparse.rs +++ b/crates/xcl/src/hle/d3d12x/sparse.rs @@ -505,11 +505,16 @@ pub unsafe fn init(dev: &ID3D12Device) -> Vec<(usize, usize, u64)> { let alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT)?; let list: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &alloc, None)?; list.Close()?; + let _ = list.SetName(windows::core::w!("xcl sparse upload list")); + let _ = alloc.SetName(windows::core::w!("xcl sparse upload allocator")); slots.push(UploadSlot { alloc, list, fence_val: 0 }); } let rb_alloc: ID3D12CommandAllocator = dev.CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT)?; let rb_list: ID3D12GraphicsCommandList = dev.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, &rb_alloc, None)?; rb_list.Close()?; + let _ = rb_list.SetName(windows::core::w!("xcl sparse readback list")); + let _ = rb_alloc.SetName(windows::core::w!("xcl sparse readback allocator")); + let _ = queue.SetName(windows::core::w!("xcl sparse queue")); Ok(State { dev: dev.clone(), queue, @@ -768,6 +773,9 @@ impl State { } let _ = self.fence.SetEventOnCompletion(target, self.event); windows::Win32::System::Threading::WaitForSingleObject(self.event, 5000); + if self.fence.GetCompletedValue() < target { + crate::xlog_warn!("sparse: the queue has not reached fence value {target} after 5 s (at {})", self.fence.GetCompletedValue()); + } } #[inline]