Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/session/session.cpp
| Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | void Session::start() | ||||
| } | } | ||||
| session_thread_cond_.notify_all(); | session_thread_cond_.notify_all(); | ||||
| } | } | ||||
| void Session::cancel(bool quick) | void Session::cancel(bool quick) | ||||
| { | { | ||||
| /* Check if session thread is rendering. */ | /* Check if session thread is rendering. */ | ||||
| bool rendering; | const bool rendering = is_session_thread_rendering(); | ||||
| { | |||||
| thread_scoped_lock session_thread_lock(session_thread_mutex_); | |||||
| rendering = (session_thread_state_ == SESSION_THREAD_RENDER); | |||||
| } | |||||
| if (rendering) { | if (rendering) { | ||||
| /* Cancel path trace operations. */ | /* Cancel path trace operations. */ | ||||
| if (quick && path_trace_) { | if (quick && path_trace_) { | ||||
| path_trace_->cancel(); | path_trace_->cancel(); | ||||
| } | } | ||||
| /* Cancel other operations. */ | /* Cancel other operations. */ | ||||
| ▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | void Session::thread_render() | ||||
| /* progress update */ | /* progress update */ | ||||
| if (progress.get_cancel()) | if (progress.get_cancel()) | ||||
| progress.set_status(progress.get_cancel_message()); | progress.set_status(progress.get_cancel_message()); | ||||
| else | else | ||||
| progress.set_update(); | 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 Session::run_update_for_next_iteration() | ||||
| { | { | ||||
| RenderWork render_work; | RenderWork render_work; | ||||
| thread_scoped_lock scene_lock(scene->mutex); | thread_scoped_lock scene_lock(scene->mutex); | ||||
| thread_scoped_lock reset_lock(delayed_reset_.mutex); | thread_scoped_lock reset_lock(delayed_reset_.mutex); | ||||
| bool have_tiles = true; | bool have_tiles = true; | ||||
| ▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | bool notify = false; | ||||
| thread_scoped_lock pause_lock(pause_mutex_); | thread_scoped_lock pause_lock(pause_mutex_); | ||||
| if (pause != pause_) { | if (pause != pause_) { | ||||
| pause_ = pause; | pause_ = pause; | ||||
| notify = true; | notify = true; | ||||
| } | } | ||||
| } | } | ||||
| if (session_thread_) { | if (is_session_thread_rendering()) { | ||||
| if (notify) { | if (notify) { | ||||
| pause_cond_.notify_all(); | pause_cond_.notify_all(); | ||||
| } | } | ||||
| } | } | ||||
| else if (pause_) { | else if (pause_) { | ||||
| update_status_time(pause_); | update_status_time(pause_); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines | |||||