Merge branch 'blender-v3.1-release'

This commit is contained in:
Sergey Sharybin 2022-03-03 17:47:34 +01:00
commit 908ac7dce2
2 changed files with 12 additions and 6 deletions

View File

@ -110,11 +110,7 @@ void Session::start()
void Session::cancel(bool quick)
{
/* Check if session thread is rendering. */
bool rendering;
{
thread_scoped_lock session_thread_lock(session_thread_mutex_);
rendering = (session_thread_state_ == SESSION_THREAD_RENDER);
}
const bool rendering = is_session_thread_rendering();
if (rendering) {
/* Cancel path trace operations. */
@ -275,6 +271,12 @@ void Session::thread_render()
progress.set_update();
}
bool Session::is_session_thread_rendering()
{
thread_scoped_lock session_thread_lock(session_thread_mutex_);
return (session_thread_state_ == SESSION_THREAD_RENDER);
}
RenderWork Session::run_update_for_next_iteration()
{
RenderWork render_work;
@ -557,7 +559,7 @@ void Session::set_pause(bool pause)
}
}
if (session_thread_) {
if (is_session_thread_rendering()) {
if (notify) {
pause_cond_.notify_all();
}

View File

@ -162,6 +162,10 @@ class Session {
void thread_run();
void thread_render();
/* Check whether the session thread is in `SESSION_THREAD_RENDER` state.
* Returns true if it is so. */
bool is_session_thread_rendering();
/* Update for the new iteration of the main loop in run implementation (run_cpu and run_gpu).
*
* Will take care of the following things: