diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-14 17:40:20 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-14 17:40:20 +0000 |
| commit | 957f35c4bb223d9f79d3aaec214e31ba00ffbf2a (patch) | |
| tree | 8ec3c53ec3a737139cee4a1dd5bbc21ef2d69b53 | |
| parent | CMake: made DILIGENT_CORE_DIR an internal cache variable (diff) | |
| download | DiligentCore-957f35c4bb223d9f79d3aaec214e31ba00ffbf2a.tar.gz DiligentCore-957f35c4bb223d9f79d3aaec214e31ba00ffbf2a.zip | |
QueryTest: fixed issue with OpenGL: glFinish() does not guarantee that queries become available
| -rw-r--r-- | Tests/DiligentCoreAPITest/src/QueryTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Tests/DiligentCoreAPITest/src/QueryTest.cpp b/Tests/DiligentCoreAPITest/src/QueryTest.cpp index 4b9405d3..c65cd014 100644 --- a/Tests/DiligentCoreAPITest/src/QueryTest.cpp +++ b/Tests/DiligentCoreAPITest/src/QueryTest.cpp @@ -27,6 +27,7 @@ #include <sstream> #include <vector> +#include <thread> #include "TestingEnvironment.h" @@ -201,6 +202,22 @@ protected: } pContext->WaitForIdle(); + if (pDevice->GetDeviceCaps().IsGLDevice()) + { + // glFinish() is not a guarantee that queries will become available + for (Uint32 i = 0; i < sm_NumTestQueries; ++i) + { + WaitForQuery(Queries[i]); + } + } + } + + static void WaitForQuery(IQuery* pQuery) + { + while (!pQuery->GetData(nullptr, 0)) + { + std::this_thread::yield(); + } } static constexpr Uint32 sm_TextureSize = 512; @@ -361,6 +378,13 @@ TEST_F(QueryTest, Timestamp) pContext->Flush(); pContext->FinishFrame(); pContext->WaitForIdle(); + if (pDevice->GetDeviceCaps().IsGLDevice()) + { + // glFinish() is not a guarantee that queries will become available + WaitForQuery(pQueryStart); + WaitForQuery(pQueryEnd); + } + QueryDataTimestamp QueryStartData, QueryEndData; auto QueryReady = pQueryStart->GetData(nullptr, 0); |
