summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-04-16 04:41:20 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-04-16 04:41:20 +0000
commit079680f868c1ec09013e62efde42fdd95cc1347c (patch)
tree33c64b3199fe400fb0f59183e48cf5c5e35fbf00 /Graphics
parentFixed Linux/Mac build error (diff)
downloadDiligentCore-079680f868c1ec09013e62efde42fdd95cc1347c.tar.gz
DiligentCore-079680f868c1ec09013e62efde42fdd95cc1347c.zip
Fixed issue with FenceVkImpl not waiting for Vulkan fences to signal when being destroyed, which causes Vulkan validation errors.
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/interface/Fence.h5
-rw-r--r--Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp13
2 files changed, 13 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h
index d2a27473..ef27e5df 100644
--- a/Graphics/GraphicsEngine/interface/Fence.h
+++ b/Graphics/GraphicsEngine/interface/Fence.h
@@ -43,7 +43,10 @@ struct FenceDesc : DeviceObjectAttribs
/// Fence interface
-/// Fence the methods to manipulate a fence object
+/// Defines the methods to manipulate a fence object
+///
+/// \remarks When a fence that was previously signaled by IDeviceContext::SignalFence() is destroyed,
+/// it may block the GPU until all prior commands have completed execution.
class IFence : public IDeviceObject
{
public:
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()