[Bf-blender-cvs] [23010494644] cycles-x: Fix missing render passes with constant time rendering
Sergey Sharybin
noreply at git.blender.org
Wed Jul 28 12:31:13 CEST 2021
Commit: 230104946449721721f75df03b6e31f1a462f965
Author: Sergey Sharybin
Date: Wed Jul 28 12:30:28 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB230104946449721721f75df03b6e31f1a462f965
Fix missing render passes with constant time rendering
===================================================================
M intern/cycles/integrator/path_trace.cpp
M intern/cycles/integrator/render_scheduler.cpp
M intern/cycles/integrator/render_scheduler.h
===================================================================
diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp
index c09af6c4f44..044098baef0 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -189,7 +189,7 @@ void PathTrace::render_pipeline(RenderWork render_work)
progress_update_if_needed();
- if (render_scheduler_.done()) {
+ if (render_work.write_final_result) {
buffer_write();
}
}
diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp
index 2afb99ae73c..2d672591188 100644
--- a/intern/cycles/integrator/render_scheduler.cpp
+++ b/intern/cycles/integrator/render_scheduler.cpp
@@ -136,6 +136,7 @@ void RenderScheduler::reset(const BufferParams &buffer_params, int num_samples)
state_.adaptive_sampling_threshold = 0.4f;
state_.last_work_was_denoised = false;
+ state_.final_result_was_written = false;
state_.postprocess_work_scheduled = false;
state_.path_trace_finished = false;
@@ -267,6 +268,9 @@ RenderWork RenderScheduler::get_render_work()
render_work.denoise = work_need_denoise(denoiser_delayed);
state_.last_work_was_denoised = render_work.denoise;
+ render_work.write_final_result = done();
+ state_.final_result_was_written = render_work.write_final_result;
+
render_work.update_display = work_need_update_display(denoiser_delayed);
/* A fallback display update time, for the case there is an error of display update, or when
@@ -302,6 +306,11 @@ bool RenderScheduler::set_postprocess_render_work(RenderWork *render_work)
any_scheduled = true;
}
+ if (!state_.final_result_was_written) {
+ render_work->write_final_result = true;
+ any_scheduled = true;
+ }
+
if (any_scheduled) {
render_work->update_display = true;
}
diff --git a/intern/cycles/integrator/render_scheduler.h b/intern/cycles/integrator/render_scheduler.h
index 6aa3e81dace..b205e05aa97 100644
--- a/intern/cycles/integrator/render_scheduler.h
+++ b/intern/cycles/integrator/render_scheduler.h
@@ -62,6 +62,8 @@ class RenderWork {
* device used, then it is up for the PathTracer to ignore the balancing. */
bool rebalance = false;
+ bool write_final_result = false;
+
/* Conversion to bool, to simplify checks about whether there is anything to be done for this
* work. */
inline operator bool() const
@@ -137,9 +139,6 @@ class RenderScheduler {
* the path tracer is to finish the current pixels) then false is returned. */
bool render_work_reschedule_on_idle(RenderWork &render_work);
- /* Check whether all work has been scheduled. */
- bool done() const;
-
RenderWork get_render_work();
/* Report that the path tracer started to work, after scene update and loading kernels. */
@@ -157,6 +156,12 @@ class RenderScheduler {
string full_report() const;
protected:
+ /* Check whether all work has been scheduled and time limit was not exceeded.
+ *
+ * NOTE: Tricky bit: if the time limit was reached the done() is considered to be true, but some
+ * extra work needs to be scheduled to denoise and write final result. */
+ bool done() const;
+
/* Returns true if any work was scheduled. */
bool set_postprocess_render_work(RenderWork *render_work);
@@ -312,6 +317,7 @@ class RenderScheduler {
float adaptive_sampling_threshold = 0.0f;
bool last_work_was_denoised = false;
+ bool final_result_was_written = false;
bool postprocess_work_scheduled = false;
bool path_trace_finished = false;
More information about the Bf-blender-cvs
mailing list