diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-09-09 00:42:51 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-09-09 00:42:51 +0000 |
| commit | d06553e2b4700aa026acd4445a598eadf10dfb35 (patch) | |
| tree | 534c3761a92cfb93d370b75f29f6b720a10c64a8 /Graphics/GraphicsEngineNextGenBase | |
| parent | Renamed IDeviceContext::Wait to IDeviceContext::WaitForFence (updated API ver... (diff) | |
| download | DiligentCore-d06553e2b4700aa026acd4445a598eadf10dfb35.tar.gz DiligentCore-d06553e2b4700aa026acd4445a598eadf10dfb35.zip | |
Added IDeviceContext::WaitForIdle() method (updated API version to 240028)
Diffstat (limited to 'Graphics/GraphicsEngineNextGenBase')
| -rw-r--r-- | Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h b/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h index 3f7b42d1..ea1c726c 100644 --- a/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h +++ b/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h @@ -145,37 +145,41 @@ public: Queue.ReleaseQueue.Purge(CompletedFenceValue); } - void IdleCommandQueues(bool ReleaseResources) + void IdleCommandQueue(size_t QueueIdx, bool ReleaseResources) { - for(size_t q=0; q < m_CmdQueueCount; ++q) - { - auto& Queue = m_CommandQueues[q]; + VERIFY_EXPR(QueueIdx < m_CmdQueueCount); + auto& Queue = m_CommandQueues[QueueIdx]; - Uint64 CmdBufferNumber = 0; - Uint64 FenceValue = 0; - { - std::lock_guard<std::mutex> Lock(Queue.Mtx); - - if (ReleaseResources) - { - // Increment command buffer number before idling the queue. - // This will make sure that any resource released while this function - // is running will be associated with the next command buffer submission. - CmdBufferNumber = static_cast<Uint64>(Queue.NextCmdBufferNumber); - Atomics::AtomicIncrement(Queue.NextCmdBufferNumber); - } - - FenceValue = Queue.CmdQueue->WaitForIdle(); - } + Uint64 CmdBufferNumber = 0; + Uint64 FenceValue = 0; + { + std::lock_guard<std::mutex> Lock(Queue.Mtx); if (ReleaseResources) { - Queue.ReleaseQueue.DiscardStaleResources(CmdBufferNumber, FenceValue); - Queue.ReleaseQueue.Purge(Queue.CmdQueue->GetCompletedFenceValue()); + // Increment command buffer number before idling the queue. + // This will make sure that any resource released while this function + // is running will be associated with the next command buffer submission. + CmdBufferNumber = static_cast<Uint64>(Queue.NextCmdBufferNumber); + Atomics::AtomicIncrement(Queue.NextCmdBufferNumber); } + + FenceValue = Queue.CmdQueue->WaitForIdle(); + } + + if (ReleaseResources) + { + Queue.ReleaseQueue.DiscardStaleResources(CmdBufferNumber, FenceValue); + Queue.ReleaseQueue.Purge(Queue.CmdQueue->GetCompletedFenceValue()); } } + void IdleAllCommandQueues(bool ReleaseResources) + { + for(size_t q=0; q < m_CmdQueueCount; ++q) + IdleCommandQueue(q, ReleaseResources); + } + struct SubmittedCommandBufferInfo { Uint64 CmdBufferNumber = 0; |
