summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-08-04 00:22:58 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-04 00:22:58 +0000
commit32f8ed61f2a24342bc721051a0493fc4eacc3134 (patch)
tree04e6ff61ff19e1a3c5a03dcc5aa87268aa23e7bf /Graphics/GraphicsEngineVulkan
parentAdded comparison opertors to SubpassDependencyDesc struct (diff)
downloadDiligentCore-32f8ed61f2a24342bc721051a0493fc4eacc3134.tar.gz
DiligentCore-32f8ed61f2a24342bc721051a0493fc4eacc3134.zip
Vk device: fixed issue with render pass cache destruction
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/RenderPassCache.hpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp3
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp10
3 files changed, 15 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/RenderPassCache.hpp b/Graphics/GraphicsEngineVulkan/include/RenderPassCache.hpp
index d2def841..ba21fcd9 100644
--- a/Graphics/GraphicsEngineVulkan/include/RenderPassCache.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/RenderPassCache.hpp
@@ -126,6 +126,8 @@ public:
RenderPassVkImpl* GetRenderPass(const RenderPassCacheKey& Key);
+ void Destroy();
+
private:
struct RenderPassCacheKeyHash
{
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
index 3b8e569a..18814e06 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
@@ -211,6 +211,9 @@ RenderDeviceVkImpl::~RenderDeviceVkImpl()
// the heap into release queues
m_DynamicMemoryManager.Destroy();
+ // Explicitly destroy render pass cache
+ m_ImplicitRenderPassCache.Destroy();
+
// Wait for the GPU to complete all its operations
IdleGPU();
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp b/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp
index 29b817ce..a40010f1 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp
@@ -42,13 +42,23 @@ RenderPassCache::RenderPassCache(RenderDeviceVkImpl& DeviceVk) noexcept :
RenderPassCache::~RenderPassCache()
{
+ // Render pass cache is part of the render device, so we can't release
+ // render pass objects from here as their destructors will attmept to
+ // call SafeReleaseDeviceObject.
+ VERIFY(m_Cache.empty(), "Render pass cache is not empty. Did you call Destroy?");
+}
+
+void RenderPassCache::Destroy()
+{
auto& FBCache = m_DeviceVkImpl.GetFramebufferCache();
for (auto it = m_Cache.begin(); it != m_Cache.end(); ++it)
{
FBCache.OnDestroyRenderPass(it->second->GetVkRenderPass());
}
+ m_Cache.clear();
}
+
RenderPassVkImpl* RenderPassCache::GetRenderPass(const RenderPassCacheKey& Key)
{
std::lock_guard<std::mutex> Lock{m_Mutex};