Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-08-11 20:35:45 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-08-11 20:37:18 +0300
commitc9d821294f0870faa471f1960a0ccb212d7d8d49 (patch)
tree68217d7d7bdbfcf66499c5c2c1e65bf16343e8b1 /intern/cycles/util
parentef5a44df2dadf906d42cacc16dc325ddb81fff5e (diff)
Cycles: take into account time limit for progress bar
This change allows the Cycles progress report system to take into conderation the time limit property. This allows for more accuracte progress reports for high sample count renders with short time limits. Contributed by Alaska. Differential Revision: https://developer.blender.org/D15599
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/progress.h20
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;