diff --git a/idd/LGIdd/CD3D12Device.cpp b/idd/LGIdd/CD3D12Device.cpp index 6ea84d91..430b7080 100644 --- a/idd/LGIdd/CD3D12Device.cpp +++ b/idd/LGIdd/CD3D12Device.cpp @@ -172,14 +172,15 @@ bool CD3D12Device::HeapTest() CD3D12CommandQueue * CD3D12Device::GetCopyQueue() { - for(int c = 0; c < 100; ++c) + // try for up to a maximum of 100ms to find a free copy queue + for (int c = 0; c < 100; ++c) { - for (int i = 0; i < ARRAYSIZE(m_copyQueue); ++i) - { - auto& queue = m_copyQueue[i]; - if (!queue.IsReady()) - continue; + auto& queue = m_copyQueue[m_copyQueueIndex++]; + if (m_copyQueueIndex == ARRAYSIZE(m_copyQueue)) + m_copyQueueIndex = 0; + if (queue.IsReady()) + { queue.Reset(); return &queue; } diff --git a/idd/LGIdd/CD3D12Device.h b/idd/LGIdd/CD3D12Device.h index 708320ff..be43552a 100644 --- a/idd/LGIdd/CD3D12Device.h +++ b/idd/LGIdd/CD3D12Device.h @@ -29,7 +29,8 @@ struct CD3D12Device ComPtr m_device; ComPtr m_ivshmemHeap; - CD3D12CommandQueue m_copyQueue[2]; + CD3D12CommandQueue m_copyQueue[4]; + unsigned m_copyQueueIndex = 0; CD3D12CommandQueue m_computeQueue; bool HeapTest();