summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-14 02:57:23 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:22 +0000
commitae289a9d49ab469a5fc1962274b4b0fd7eb8dfb1 (patch)
tree236cb6dabd2f0a5b2a9dc720f1b36b97a330ebf4 /Graphics/GraphicsEngine
parentReworked CommandListBase to use EngineImplTraits like the rest of the base cl... (diff)
downloadDiligentCore-ae289a9d49ab469a5fc1962274b4b0fd7eb8dfb1.tar.gz
DiligentCore-ae289a9d49ab469a5fc1962274b4b0fd7eb8dfb1.zip
Unified fence implementations in all backends
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/FenceBase.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngine/include/FenceBase.hpp b/Graphics/GraphicsEngine/include/FenceBase.hpp
index 0bcaae36..e9dc0f9f 100644
--- a/Graphics/GraphicsEngine/include/FenceBase.hpp
+++ b/Graphics/GraphicsEngine/include/FenceBase.hpp
@@ -30,6 +30,8 @@
/// \file
/// Implementation of the Diligent::FenceBase template class
+#include <atomic>
+
#include "DeviceObjectBase.hpp"
#include "GraphicsTypes.h"
#include "RefCntAutoPtr.hpp"
@@ -66,6 +68,18 @@ public:
}
IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_Fence, TDeviceObjectBase)
+
+protected:
+ void UpdateLastCompletedFenceValue(uint64_t NewValue)
+ {
+ auto LastCompletedValue = m_LastCompletedFenceValue.load();
+ while (!m_LastCompletedFenceValue.compare_exchange_strong(LastCompletedValue, std::max(LastCompletedValue, NewValue)))
+ {
+ // If exchange fails, LastCompletedValue will hold the actual value of m_LastCompletedFenceValue.
+ }
+ }
+
+ std::atomic_uint64_t m_LastCompletedFenceValue{0};
};
} // namespace Diligent