summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-07-24 16:46:45 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-07-24 16:46:45 +0000
commit1ca52f424e4aac8a31a36b72910efec014cd9c4c (patch)
tree37922d30a62d63affdb9e89d8f64a48b6e8116fa /Graphics/GraphicsEngineVulkan
parentFixed issue with Device context destruction in Vulkan backend (diff)
downloadDiligentCore-1ca52f424e4aac8a31a36b72910efec014cd9c4c.tar.gz
DiligentCore-1ca52f424e4aac8a31a36b72910efec014cd9c4c.zip
Added extra debug checks to ~DeviceContextVkImpl()
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h6
-rw-r--r--Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanDescriptorPool.h5
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp10
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp2
4 files changed, 23 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h
index af4f8dd7..2777a78e 100644
--- a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h
+++ b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h
@@ -128,6 +128,12 @@ public:
DescriptorPoolAllocation Allocate(VkDescriptorSetLayout SetLayout);
void DisposeAllocations(uint64_t FenceValue);
void ReleaseStaleAllocations(uint64_t LastCompletedFence);
+
+ size_t GetStaleAllocationCount()const
+ {
+ return m_ReleasedAllocations.size();
+ }
+ size_t GetPendingReleaseAllocationCount();
private:
friend class DescriptorPoolAllocation;
diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanDescriptorPool.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanDescriptorPool.h
index 34bbb99d..7a429147 100644
--- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanDescriptorPool.h
+++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanDescriptorPool.h
@@ -48,6 +48,11 @@ namespace VulkanUtilities
void ReleaseDiscardedSets(uint64_t LastCompletedFence);
DescriptorPoolWrapper&& Release();
+
+ size_t GetDiscardedSetCount()const
+ {
+ return m_DiscardedSets.size();
+ }
private:
// Shared point to logical device must be defined before the command pool
diff --git a/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp b/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp
index d6c22d8a..45cba04d 100644
--- a/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp
@@ -112,4 +112,14 @@ void DescriptorPoolManager::ReleaseStaleAllocations(uint64_t LastCompletedFence)
Pool->ReleaseDiscardedSets(LastCompletedFence);
}
+size_t DescriptorPoolManager::GetPendingReleaseAllocationCount()
+{
+ size_t count = 0;
+ std::lock_guard<std::mutex> Lock(m_Mutex);
+ for(auto &Pool : m_DescriptorPools)
+ count += Pool->GetDiscardedSetCount();
+ return count;
+}
+
+
}
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 1d9c4e05..39e7d744 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -142,9 +142,11 @@ namespace Diligent
// moved to the release queue by Flush(). For deferred contexts, this should have happened in the last FinishCommandList()
// call.
VERIFY(m_ReleaseQueue.GetStaleResourceCount() == 0, "All stale resources must have been discarded at this point");
+ VERIFY(m_DynamicDescriptorPool.GetStaleAllocationCount() == 0, "All stale dynamic descriptor set allocations must have been discarded at this point");
ReleaseStaleContextResources(m_NextCmdBuffNumber, pDeviceVkImpl->GetNextFenceValue(), pDeviceVkImpl->GetCompletedFenceValue());
// Since we idled the GPU, all stale resources must have been destroyed now
VERIFY(m_ReleaseQueue.GetPendingReleaseResourceCount() == 0, "All stale resources must have been destroyed at this point");
+ VERIFY(m_DynamicDescriptorPool.GetPendingReleaseAllocationCount() == 0, "All stale descriptor set allocations must have been destroyed at this point");
auto VkCmdPool = m_CmdPool.Release();
pDeviceVkImpl->SafeReleaseVkObject(std::move(VkCmdPool));