Create presentation thread

This commit is contained in:
2021-08-10 17:57:13 -07:00
parent 7965da421c
commit 8b59c5c382
3 changed files with 35 additions and 1 deletions

View File

@@ -106,9 +106,13 @@ KRContext::KRContext(const KrInitializeInfo* initializeInfo)
#endif
createDeviceContexts();
m_presentationThread = std::thread(&KRContext::presentationThreadFunc, this);
}
KRContext::~KRContext() {
m_stop = true;
m_presentationThread.join();
if(m_pSceneManager) {
delete m_pSceneManager;
m_pSceneManager = NULL;
@@ -1187,3 +1191,27 @@ KrResult KRContext::deleteWindowSurface(const KrDeleteWindowSurfaceInfo* deleteW
m_surfaces.erase(itr);
return KR_SUCCESS;
}
void KRContext::presentationThreadFunc()
{
#if defined(ANDROID)
// TODO - Set thread names on Android
#elif defined(_WIN32) || defined(_WIN64)
// TODO - Set thread names on windows
#else
pthread_setname_np("Kraken - Presentation");
#endif
std::chrono::microseconds sleep_duration(15000);
while (!m_stop)
{
renderFrame();
std::this_thread::sleep_for(sleep_duration);
}
}
void KRContext::renderFrame()
{
}