summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsTools
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-25 23:11:48 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-25 23:11:48 +0000
commitdf6a316b684e2f2214e0b987f735c3e20a1d3418 (patch)
tree0d83288d8996b8ca7394d04648bbc371b89d687f /Graphics/GraphicsTools
parentAdded IRenderDeviceGL::CreateDummyTexture method (API version 240047) (diff)
downloadDiligentCore-df6a316b684e2f2214e0b987f735c3e20a1d3418.tar.gz
DiligentCore-df6a316b684e2f2214e0b987f735c3e20a1d3418.zip
Added ScreenCapture::HasCapture method
Diffstat (limited to 'Graphics/GraphicsTools')
-rw-r--r--Graphics/GraphicsTools/include/ScreenCapture.h1
-rw-r--r--Graphics/GraphicsTools/src/ScreenCapture.cpp15
2 files changed, 16 insertions, 0 deletions
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<ITexture>&& 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<std::mutex> 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<ITexture>&& pTexture)
{
std::lock_guard<std::mutex> Lock{m_AvailableTexturesMtx};