From df6a316b684e2f2214e0b987f735c3e20a1d3418 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 25 Dec 2019 15:11:48 -0800 Subject: Added ScreenCapture::HasCapture method --- Graphics/GraphicsTools/include/ScreenCapture.h | 1 + Graphics/GraphicsTools/src/ScreenCapture.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'Graphics/GraphicsTools') diff --git a/Graphics/GraphicsTools/include/ScreenCapture.h b/Graphics/GraphicsTools/include/ScreenCapture.h index b49eedab..019bfa2a 100644 --- a/Graphics/GraphicsTools/include/ScreenCapture.h +++ b/Graphics/GraphicsTools/include/ScreenCapture.h @@ -54,6 +54,7 @@ public: }; CaptureInfo GetCapture(); + bool HasCapture(); void RecycleStagingTexture(RefCntAutoPtr&& pTexture); diff --git a/Graphics/GraphicsTools/src/ScreenCapture.cpp b/Graphics/GraphicsTools/src/ScreenCapture.cpp index bcd87495..10455531 100644 --- a/Graphics/GraphicsTools/src/ScreenCapture.cpp +++ b/Graphics/GraphicsTools/src/ScreenCapture.cpp @@ -104,6 +104,21 @@ ScreenCapture::CaptureInfo ScreenCapture::GetCapture() return Capture; } +bool ScreenCapture::HasCapture() +{ + std::lock_guard Lock{m_PendingTexturesMtx}; + if (!m_PendingTextures.empty()) + { + const auto& OldestCapture = m_PendingTextures.front(); + auto CompletedFenceValue = m_pFence->GetCompletedValue(); + return OldestCapture.Fence <= CompletedFenceValue; + } + else + { + return false; + } +} + void ScreenCapture::RecycleStagingTexture(RefCntAutoPtr&& pTexture) { std::lock_guard Lock{m_AvailableTexturesMtx}; -- cgit v1.2.3