Fix Cycles viewport render doing some unnecessary work at the start.

In some cases it would load adaptive kernels or even start rendering
twice because the first time the scene was not fully synced yet.
This commit is contained in:
Brecht Van Lommel 2019-01-09 16:57:01 +01:00
parent b7fb3296c1
commit 0bb0e07e61
2 changed files with 11 additions and 7 deletions

@ -110,9 +110,6 @@ BlenderSession::~BlenderSession()
void BlenderSession::create()
{
create_session();
if(b_v3d)
session->start();
}
void BlenderSession::create_session()
@ -784,7 +781,6 @@ void BlenderSession::synchronize()
{
free_session();
create_session();
session->start();
return;
}
@ -833,6 +829,10 @@ void BlenderSession::synchronize()
/* reset time */
start_resize_time = 0.0;
}
/* Start rendering thread, if it's not running already. Do this
* after all scene data has been synced at least once. */
session->start();
}
bool BlenderSession::draw(int w, int h)

@ -129,7 +129,9 @@ Session::~Session()
void Session::start()
{
session_thread = new thread(function_bind(&Session::run, this));
if (!session_thread) {
session_thread = new thread(function_bind(&Session::run, this));
}
}
bool Session::ready_to_reset()
@ -830,8 +832,10 @@ void Session::set_pause(bool pause_)
void Session::wait()
{
session_thread->join();
delete session_thread;
if (session_thread) {
session_thread->join();
delete session_thread;
}
session_thread = NULL;
}