Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/session.cpp
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
| bool Session::ready_to_reset() | bool Session::ready_to_reset() | ||||
| { | { | ||||
| return path_trace_->ready_to_reset(); | return path_trace_->ready_to_reset(); | ||||
| } | } | ||||
| void Session::run_main_render_loop() | void Session::run_main_render_loop() | ||||
| { | { | ||||
| while (!progress.get_cancel()) { | while (true) { | ||||
| const RenderWork render_work = run_update_for_next_iteration(); | const bool did_cancel = progress.get_cancel(); | ||||
| RenderWork render_work = run_update_for_next_iteration(); | |||||
| if (!render_work) { | if (!render_work) { | ||||
| if (VLOG_IS_ON(2)) { | if (VLOG_IS_ON(2)) { | ||||
| double total_time, render_time; | double total_time, render_time; | ||||
| progress.get_time(total_time, render_time); | progress.get_time(total_time, render_time); | ||||
| VLOG(2) << "Rendering in main loop is done in " << render_time << " seconds."; | VLOG(2) << "Rendering in main loop is done in " << render_time << " seconds."; | ||||
| VLOG(2) << path_trace_->full_report(); | VLOG(2) << path_trace_->full_report(); | ||||
| } | } | ||||
| if (params.background) { | if (params.background) { | ||||
| /* if no work left and in background mode, we can stop immediately. */ | /* if no work left and in background mode, we can stop immediately. */ | ||||
| progress.set_status("Finished"); | progress.set_status("Finished"); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (run_wait_for_work(render_work)) { | if (did_cancel) { | ||||
| continue; | render_scheduler_.render_work_reschedule_on_cancel(render_work); | ||||
| } | if (!render_work) { | ||||
| if (progress.get_cancel()) { | |||||
| break; | break; | ||||
| } | } | ||||
| } | |||||
| else if (run_wait_for_work(render_work)) { | |||||
| continue; | |||||
| } | |||||
| { | { | ||||
| /* buffers mutex is locked entirely while rendering each | /* buffers mutex is locked entirely while rendering each | ||||
| * sample, and released/reacquired on each iteration to allow | * sample, and released/reacquired on each iteration to allow | ||||
| * reset and draw in between */ | * reset and draw in between */ | ||||
| thread_scoped_lock buffers_lock(buffers_mutex_); | thread_scoped_lock buffers_lock(buffers_mutex_); | ||||
| /* update status and timing */ | /* update status and timing */ | ||||
| Show All 9 Lines | else if (run_wait_for_work(render_work)) { | ||||
| const string &error_message = device->error_message(); | const string &error_message = device->error_message(); | ||||
| progress.set_error(error_message); | progress.set_error(error_message); | ||||
| progress.set_cancel(error_message); | progress.set_cancel(error_message); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| progress.set_update(); | progress.set_update(); | ||||
| if (did_cancel) { | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| void Session::run() | void Session::run() | ||||
| { | { | ||||
| if (params.use_profiling && (params.device.type == DEVICE_CPU)) { | if (params.use_profiling && (params.device.type == DEVICE_CPU)) { | ||||
| profiler.start(); | profiler.start(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 460 Lines • Show Last 20 Lines | |||||