summaryrefslogtreecommitdiffstats
path: root/Tests/TestApp/src
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-09-09 01:15:48 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-09-09 01:15:48 +0000
commite2b6526463fdb04c382e56c809b3f86a6764a7ed (patch)
treef32aefdcb4f6712533fc70af6e7885747369063d /Tests/TestApp/src
parentUpdated core module (diff)
downloadDiligentEngine-e2b6526463fdb04c382e56c809b3f86a6764a7ed.tar.gz
DiligentEngine-e2b6526463fdb04c382e56c809b3f86a6764a7ed.zip
Updated core and added tests for wait* methods
Diffstat (limited to 'Tests/TestApp/src')
-rw-r--r--Tests/TestApp/src/TestApp.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/Tests/TestApp/src/TestApp.cpp b/Tests/TestApp/src/TestApp.cpp
index 514519c..3a7b499 100644
--- a/Tests/TestApp/src/TestApp.cpp
+++ b/Tests/TestApp/src/TestApp.cpp
@@ -25,6 +25,8 @@
#include <math.h>
#include <iomanip>
+#include <cstdlib>
+
#include "PlatformDefinitions.h"
#include "TestApp.h"
#include "Errors.h"
@@ -304,7 +306,7 @@ void TestApp::InitializeDiligentEngine(
EngVkAttribs.NumDeferredContexts = NumDeferredCtx;
ppContexts.resize(1 + NumDeferredCtx);
- auto *pFactoryVk = GetEngineFactoryVk();
+ auto* pFactoryVk = GetEngineFactoryVk();
pFactoryVk->CreateDeviceAndContextsVk(EngVkAttribs, &m_pDevice, ppContexts.data());
if (!m_pSwapChain && NativeWindowHandle != nullptr)
@@ -710,17 +712,41 @@ void TestApp::Render()
m_pTestRT->Draw();
m_pTestShaderResArrays->Draw();
m_TestGS.Draw();
- m_TestTessellation.Draw();
auto CompletedFenceValue = m_pFence->GetCompletedValue();
VERIFY_EXPR(CompletedFenceValue < m_NextFenceValue);
m_pImmediateContext->SignalFence(m_pFence, m_NextFenceValue++);
- m_pImmediateContext->Flush();
- m_pImmediateContext->InvalidateState();
-
CompletedFenceValue = m_pFence->GetCompletedValue();
VERIFY_EXPR(CompletedFenceValue < m_NextFenceValue);
+
+ if (rand() % 10 == 0)
+ {
+ if (rand() % 2 == 0)
+ {
+ m_pImmediateContext->Flush();
+ m_pImmediateContext->SignalFence(m_pFence, m_NextFenceValue++);
+ }
+
+ m_pImmediateContext->WaitForFence(m_pFence, m_NextFenceValue-1, true);
+ CompletedFenceValue = m_pFence->GetCompletedValue();
+ VERIFY_EXPR(CompletedFenceValue >= m_NextFenceValue-1);
+ }
+
+ if (rand() % 30 == 0)
+ {
+ m_pImmediateContext->WaitForIdle();
+ }
+
+ if (rand() % 60 == 0)
+ {
+ m_pDevice->IdleGPU();
+ }
+
+ m_TestTessellation.Draw();
+
+ m_pImmediateContext->Flush();
+ m_pImmediateContext->InvalidateState();
}
void TestApp::Present()