diff options
Diffstat (limited to 'intern/cycles/util/progress.h')
-rw-r--r-- | intern/cycles/util/progress.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/intern/cycles/util/progress.h b/intern/cycles/util/progress.h index 37eafd57491..586979d2021 100644 --- a/intern/cycles/util/progress.h +++ b/intern/cycles/util/progress.h @@ -28,6 +28,7 @@ class Progress { denoised_tiles = 0; start_time = time_dt(); render_start_time = time_dt(); + time_limit = 0.0; end_time = 0.0; status = "Initializing"; substatus = ""; @@ -68,6 +69,7 @@ class Progress { denoised_tiles = 0; start_time = time_dt(); render_start_time = time_dt(); + time_limit = 0.0; end_time = 0.0; status = "Initializing"; substatus = ""; @@ -145,6 +147,13 @@ class Progress { render_start_time = time_dt(); } + void set_time_limit(double time_limit_) + { + thread_scoped_lock lock(progress_mutex); + + time_limit = time_limit_; + } + void add_skip_time(const scoped_timer &start_timer, bool only_render) { double skip_time = time_dt() - start_timer.get_start(); @@ -191,8 +200,13 @@ class Progress { { thread_scoped_lock lock(progress_mutex); - if (total_pixel_samples > 0) { - return ((double)pixel_samples) / (double)total_pixel_samples; + if (pixel_samples > 0) { + double progress_percent = (double)pixel_samples / (double)total_pixel_samples; + if (time_limit != 0.0) { + double time_since_render_start = time_dt() - render_start_time; + progress_percent = max(progress_percent, time_since_render_start / time_limit); + } + return min(1.0, progress_percent); } return 0.0; } @@ -335,7 +349,7 @@ class Progress { * in which case the current_tile_sample is displayed. */ int rendered_tiles, denoised_tiles; - double start_time, render_start_time; + double start_time, render_start_time, time_limit; /* End time written when render is done, so it doesn't keep increasing on redraws. */ double end_time; |