diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-14 02:57:23 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:22 +0000 |
| commit | ae289a9d49ab469a5fc1962274b4b0fd7eb8dfb1 (patch) | |
| tree | 236cb6dabd2f0a5b2a9dc720f1b36b97a330ebf4 /Graphics/GraphicsEngineOpenGL | |
| parent | Reworked CommandListBase to use EngineImplTraits like the rest of the base cl... (diff) | |
| download | DiligentCore-ae289a9d49ab469a5fc1962274b4b0fd7eb8dfb1.tar.gz DiligentCore-ae289a9d49ab469a5fc1962274b4b0fd7eb8dfb1.zip | |
Unified fence implementations in all backends
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.hpp | 5 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp | 15 |
2 files changed, 3 insertions, 17 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.hpp index d0095402..727886cb 100644 --- a/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.hpp +++ b/Graphics/GraphicsEngineOpenGL/include/FenceGLImpl.hpp @@ -68,12 +68,7 @@ public: void Wait(Uint64 Value, bool FlushCommands); private: - void UpdateFenceValue(Uint64 NewValue); - -private: std::deque<std::pair<Uint64, GLObjectWrappers::GLSyncObj>> m_PendingFences; - - std::atomic_uint64_t m_LastCompletedFenceValue{0}; }; } // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp index fe88669e..677e1db9 100644 --- a/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp @@ -52,15 +52,6 @@ FenceGLImpl::~FenceGLImpl() { } -void FenceGLImpl::UpdateFenceValue(Uint64 NewValue) -{ - auto CurrValue = m_LastCompletedFenceValue.load(); - while (!m_LastCompletedFenceValue.compare_exchange_strong(CurrValue, std::max(CurrValue, NewValue))) - { - // If exchange fails, CurrValue will hold the actual value of m_LastCompletedFenceValue - } -} - Uint64 FenceGLImpl::GetCompletedValue() { while (!m_PendingFences.empty()) @@ -74,7 +65,7 @@ Uint64 FenceGLImpl::GetCompletedValue() ); if (res == GL_ALREADY_SIGNALED) { - UpdateFenceValue(val_fence.first); + UpdateLastCompletedFenceValue(val_fence.first); m_PendingFences.pop_front(); } else @@ -98,7 +89,7 @@ void FenceGLImpl::Wait(Uint64 Value, bool FlushCommands) VERIFY_EXPR(res == GL_ALREADY_SIGNALED || res == GL_CONDITION_SATISFIED); (void)res; - UpdateFenceValue(val_fence.first); + UpdateLastCompletedFenceValue(val_fence.first); m_PendingFences.pop_front(); } } @@ -106,7 +97,7 @@ void FenceGLImpl::Wait(Uint64 Value, bool FlushCommands) void FenceGLImpl::Reset(Uint64 NewValue) { DEV_CHECK_ERR(NewValue >= m_LastCompletedFenceValue, "Resetting fence '", m_Desc.Name, "' to the value (", NewValue, ") that is smaller than the last completed value (", m_LastCompletedFenceValue, ")"); - UpdateFenceValue(NewValue); + UpdateLastCompletedFenceValue(NewValue); } } // namespace Diligent |
