diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-05-04 20:46:13 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-05-04 21:01:04 +0300 |
commit | ac9ebc9de31fc923f3e867e6741298a1e1eb175f (patch) | |
tree | b88261ad1c26e261baa18cfccf6e5435efa97502 /intern/cycles | |
parent | fc0f6d19adae47cfb2d0abd31f4b44395179cb89 (diff) |
Fix Cycles division by zero in material preview render
If the render gets cancelled before the first sample finishes.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/integrator/render_scheduler.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp index a75662c90d8..ebc3170393f 100644 --- a/intern/cycles/integrator/render_scheduler.cpp +++ b/intern/cycles/integrator/render_scheduler.cpp @@ -750,6 +750,11 @@ double RenderScheduler::guess_display_update_interval_in_seconds_for_num_samples int RenderScheduler::calculate_num_samples_per_update() const { const double time_per_sample_average = path_trace_time_.get_average(); + /* Fall back to 1 sample if we have not recorded a time yet. */ + if (time_per_sample_average == 0.0) { + return 1; + } + const double num_samples_in_second = pixel_size_ * pixel_size_ / time_per_sample_average; const double update_interval_in_seconds = guess_display_update_interval_in_seconds(); |