Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/session.cpp
| Context not available. | |||||
| Session::Session(const SessionParams ¶ms_, const SceneParams &scene_params) | Session::Session(const SessionParams ¶ms_, const SceneParams &scene_params) | ||||
| : params(params_), render_scheduler_(tile_manager_, params) | : params(params_), render_scheduler_(tile_manager_, params) | ||||
| { | { | ||||
| cancel_ = true; | |||||
| TaskScheduler::init(params.threads); | TaskScheduler::init(params.threads); | ||||
| session_thread_ = nullptr; | session_thread_ = nullptr; | ||||
| Context not available. | |||||
| delayed_reset_.samples = 0; | delayed_reset_.samples = 0; | ||||
| pause_ = false; | pause_ = false; | ||||
| cancel_ = false; | |||||
| new_work_added_ = false; | new_work_added_ = false; | ||||
| device = Device::create(params.device, stats, profiler); | device = Device::create(params.device, stats, profiler); | ||||
| Context not available. | |||||
| return true; | return true; | ||||
| }; | }; | ||||
| path_trace_->progress_update_cb = [&]() { update_status_time(); }; | path_trace_->progress_update_cb = [&]() { update_status_time(); }; | ||||
| cancel_ = false; | |||||
| } | } | ||||
| Session::~Session() | Session::~Session() | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| void Session::wait_for_rendering_to_finish() { | |||||
| // Wait for rendering to finish | |||||
| while ( rendering_.load() ){ | |||||
| std::this_thread::sleep_for(std::chrono::milliseconds(5)); | |||||
| } | |||||
| } | |||||
| void Session::cancel(bool quick) | void Session::cancel(bool quick) | ||||
| { | { | ||||
| if (quick && path_trace_) { | if (quick && path_trace_) { | ||||
| Context not available. | |||||
| if (session_thread_) { | if (session_thread_) { | ||||
| /* wait for session thread to end */ | /* wait for session thread to end */ | ||||
| progress.set_cancel("Exiting"); | progress.set_cancel("Exiting"); | ||||
| { | { | ||||
| thread_scoped_lock pause_lock(pause_mutex_); | thread_scoped_lock pause_lock(pause_mutex_); | ||||
| pause_ = false; | pause_ = false; | ||||
| cancel_ = true; | cancel_ = true; | ||||
| wait_for_rendering_to_finish(); | |||||
| } | } | ||||
| pause_cond_.notify_all(); | pause_cond_.notify_all(); | ||||
| wait(); | wait(); | ||||
| } else { | |||||
| cancel_ = true; | |||||
| wait_for_rendering_to_finish(); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| void Session::draw() | void Session::draw() | ||||
| { | { | ||||
| path_trace_->draw(); | rendering_ = true; | ||||
| if(!cancel_) { | |||||
| path_trace_->draw(); | |||||
| } | |||||
| rendering_ = false; | |||||
| } | } | ||||
| int2 Session::get_effective_tile_size() const | int2 Session::get_effective_tile_size() const | ||||
| Context not available. | |||||