From 079680f868c1ec09013e62efde42fdd95cc1347c Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 15 Apr 2019 21:41:20 -0700 Subject: Fixed issue with FenceVkImpl not waiting for Vulkan fences to signal when being destroyed, which causes Vulkan validation errors. --- Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp index 12273300..3314598a 100644 --- a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp @@ -41,10 +41,15 @@ FenceVkImpl :: FenceVkImpl(IReferenceCounters* pRefCounters, FenceVkImpl :: ~FenceVkImpl() { - // Do not dispose pending fences as the pool checks that the fence - // is signaled, while pending fences may not be. - // The pool will be destroyed next anyway, so it makes no difference. - m_PendingFences.clear(); + if (!m_PendingFences.empty()) + { + LOG_INFO_MESSAGE("FenceVkImpl::~FenceVkImpl(): waiting for ", m_PendingFences.size(), " pending Vulkan ", + (m_PendingFences.size() > 1 ? "fences." : "fence.")); + // Vulkan spec states that all queue submission commands that refer to + // a fence must have completed execution before the fence is destroyed. + // (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyFence-fence-01120) + Wait(); + } } Uint64 FenceVkImpl :: GetCompletedValue() -- cgit v1.2.3