[idd] d3d12: harvest completed command slots

Check a busy slot fence before waiting for its thread-pool callback.
This lets the caller complete finished GPU work inline and avoids a
scheduler delay before the allocator and command list can be reused.
This commit is contained in:
Geoffrey McRae
2026-08-06 12:34:06 +10:00
parent 6bb5c039cd
commit babfe9b1e2

View File

@@ -510,6 +510,12 @@ CD3D12CommandSlot * CD3D12CommandQueue::Acquire(UINT slotIndex)
const ULONGLONG deadline = GetTickCount64() + 100; const ULONGLONG deadline = GetTickCount64() + 100;
for (;;) for (;;)
{ {
if (m_slots[slotIndex].Acquire())
return &m_slots[slotIndex];
// The GPU may already be finished while its thread-pool callback is
// still pending. Complete it here before sleeping on callback dispatch.
m_slots[slotIndex].OnCompletion(false);
if (m_slots[slotIndex].Acquire()) if (m_slots[slotIndex].Acquire())
return &m_slots[slotIndex]; return &m_slots[slotIndex];
if (m_failed.load(std::memory_order_acquire)) if (m_failed.load(std::memory_order_acquire))