add abr color dynamics

This commit is contained in:
2019-03-07 00:53:45 +01:00
parent 3296de98cc
commit 5329147d58
14 changed files with 78 additions and 31 deletions

View File

@@ -34,7 +34,6 @@ std::thread hmd_renderer;
std::thread renderer;
int running = -1;
std::mutex render_mutex;
std::mutex wnd_mutex;
std::condition_variable render_cv;
int gl_count = 0;
@@ -687,12 +686,11 @@ int main(int argc, char** argv)
static wchar_t title_fps[512];
swprintf_s(title_fps, L"%s - %d fps", window_title, frames);
// lock if
if (wnd_mutex.try_lock())
{
std::lock_guard<std::mutex> lock(main_task_mutex);
main_tasklist.emplace_back([=] {
SetWindowText(hWnd, title_fps);
wnd_mutex.unlock();
}
});
one_sec = 0;
frames = 0;
}
@@ -869,18 +867,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
running = 0;
render_cv.notify_all();
{
// avoid deadlock
// nobody should call windows API on this window at this time
std::lock_guard<std::mutex> lock(wnd_mutex);
if (renderer.joinable())
renderer.join();
if (hmd_renderer.joinable())
hmd_renderer.join();
}
if (renderer.joinable())
renderer.join();
if (hmd_renderer.joinable())
hmd_renderer.join();
App::I.terminate();
}
break;