diff --git a/idd/LGIdd/CD3D12CommandQueue.cpp b/idd/LGIdd/CD3D12CommandQueue.cpp index 5d48f362..98cff4a3 100644 --- a/idd/LGIdd/CD3D12CommandQueue.cpp +++ b/idd/LGIdd/CD3D12CommandQueue.cpp @@ -510,6 +510,12 @@ CD3D12CommandSlot * CD3D12CommandQueue::Acquire(UINT slotIndex) const ULONGLONG deadline = GetTickCount64() + 100; 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()) return &m_slots[slotIndex]; if (m_failed.load(std::memory_order_acquire))