Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/integrator/render_scheduler.cpp
| Show First 20 Lines • Show All 834 Lines • ▼ Show 20 Lines | int RenderScheduler::get_num_samples_to_path_trace() const | ||||
| if (state_.occupancy_num_samples && (background_ || headless_)) { | if (state_.occupancy_num_samples && (background_ || headless_)) { | ||||
| /* Keep occupancy at about 0.5 (this is more of an empirical figure which seems to match scenes | /* Keep occupancy at about 0.5 (this is more of an empirical figure which seems to match scenes | ||||
| * with good performance without forcing occupancy to be higher). */ | * with good performance without forcing occupancy to be higher). */ | ||||
| int num_samples_to_occupy = state_.occupancy_num_samples; | int num_samples_to_occupy = state_.occupancy_num_samples; | ||||
| if (state_.occupancy < 0.5f) { | if (state_.occupancy < 0.5f) { | ||||
| num_samples_to_occupy = lround(state_.occupancy_num_samples * 0.7f / state_.occupancy); | num_samples_to_occupy = lround(state_.occupancy_num_samples * 0.7f / state_.occupancy); | ||||
| } | } | ||||
| /* When time limit is used clamp the calculated number of samples to keep occupancy. | |||||
| * This is because time limit causes the last render iteration to happen with less number of | |||||
| * samples, which conflicts with the occupancy (lower number of samples causes lower | |||||
| * occupancy, also the calculation is based on number of previously rendered samples). | |||||
| * | |||||
| * When time limit is not used the number of samples per render iteration is either increasing | |||||
| * or stays the same, so there is no need to clamp number of samples calculated for occupancy. | |||||
| */ | |||||
| if (time_limit_ != 0.0 && state_.start_render_time != 0.0) { | |||||
| const double remaining_render_time = max( | |||||
| 0.0, time_limit_ - (time_dt() - state_.start_render_time)); | |||||
| const double time_per_sample_average = path_trace_time_.get_average(); | |||||
| const double predicted_render_time = num_samples_to_occupy * time_per_sample_average; | |||||
| if (predicted_render_time > remaining_render_time) { | |||||
| num_samples_to_occupy = lround(num_samples_to_occupy * | |||||
| (remaining_render_time / predicted_render_time)); | |||||
| } | |||||
| } | |||||
| num_samples_to_render = max(num_samples_to_render, | num_samples_to_render = max(num_samples_to_render, | ||||
| min(num_samples_to_occupy, max_num_samples_to_render)); | min(num_samples_to_occupy, max_num_samples_to_render)); | ||||
| } | } | ||||
| /* If adaptive sampling is not use, render as many samples per update as possible, keeping the | /* If adaptive sampling is not use, render as many samples per update as possible, keeping the | ||||
| * device fully occupied, without much overhead of display updates. */ | * device fully occupied, without much overhead of display updates. */ | ||||
| if (!adaptive_sampling_.use) { | if (!adaptive_sampling_.use) { | ||||
| return num_samples_to_render; | return num_samples_to_render; | ||||
| ▲ Show 20 Lines • Show All 356 Lines • Show Last 20 Lines | |||||