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/GraphicsEngineD3D11 | |
| 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/GraphicsEngineD3D11')
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp | 6 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp | 14 |
2 files changed, 8 insertions, 12 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp index 9385d3c4..49b5ea54 100644 --- a/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp @@ -31,10 +31,11 @@ /// Declaration of Diligent::FenceD3D11Impl class #include <deque> +#include <atlbase.h> + +#include "EngineD3D11ImplTraits.hpp" #include "FenceD3D11.h" -#include "RenderDeviceD3D11.h" #include "FenceBase.hpp" -#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { @@ -81,7 +82,6 @@ private: {} }; std::deque<PendingFenceData> m_PendingQueries; - volatile Uint64 m_LastCompletedFenceValue = 0; }; } // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp index 28da90ff..2bb2bdf5 100644 --- a/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp @@ -26,9 +26,9 @@ */ #include "pch.h" -#include <atlbase.h> #include "FenceD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent @@ -55,8 +55,7 @@ Uint64 FenceD3D11Impl::GetCompletedValue() if (res == S_OK) { VERIFY_EXPR(Data == TRUE); - if (QueryData.Value > m_LastCompletedFenceValue) - m_LastCompletedFenceValue = QueryData.Value; + UpdateLastCompletedFenceValue(QueryData.Value); m_PendingQueries.pop_front(); } else @@ -65,7 +64,7 @@ Uint64 FenceD3D11Impl::GetCompletedValue() } } - return m_LastCompletedFenceValue; + return m_LastCompletedFenceValue.load(); } void FenceD3D11Impl::Wait(Uint64 Value, bool FlushCommands) @@ -81,9 +80,7 @@ void FenceD3D11Impl::Wait(Uint64 Value, bool FlushCommands) std::this_thread::yield(); VERIFY_EXPR(Data == TRUE); - if (QueryData.Value > m_LastCompletedFenceValue) - m_LastCompletedFenceValue = QueryData.Value; - + UpdateLastCompletedFenceValue(QueryData.Value); m_PendingQueries.pop_front(); } } @@ -91,8 +88,7 @@ void FenceD3D11Impl::Wait(Uint64 Value, bool FlushCommands) void FenceD3D11Impl::Reset(Uint64 Value) { DEV_CHECK_ERR(Value >= m_LastCompletedFenceValue, "Resetting fence '", m_Desc.Name, "' to the value (", Value, ") that is smaller than the last completed value (", m_LastCompletedFenceValue, ")"); - if (Value > m_LastCompletedFenceValue) - m_LastCompletedFenceValue = Value; + UpdateLastCompletedFenceValue(Value); } } // namespace Diligent |
