add abr color dynamics
This commit is contained in:
26
src/main.cpp
26
src/main.cpp
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user