Commit: 5b92af33b03085efc21e1ae774d1c295d8ae4934
Author: Sergey Sharybin
Date:   Thu Sep 16 13:00:07 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB5b92af33b03085efc21e1ae774d1c295d8ae4934

Fix invalid address error in Cycles X GPUDisplay update

Make sure no display update happens after full buffer was written.
Makes it possible to free memory used by path trace works without
causing issues.

===================================================================

M       intern/cycles/integrator/path_trace_work_gpu.cpp
M       intern/cycles/integrator/render_scheduler.cpp

===================================================================

diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp 
b/intern/cycles/integrator/path_trace_work_gpu.cpp
index af4d416117a..7f15237ddbf 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -678,6 +678,11 @@ void PathTraceWorkGPU::copy_to_gpu_display(GPUDisplay 
*gpu_display,
     return;
   }
 
+  if (!buffers_->buffer.device_pointer) {
+    LOG(WARNING) << "Request for GPU display update without allocated render 
buffers.";
+    return;
+  }
+
   if (should_use_graphics_interop()) {
     if (copy_to_gpu_display_interop(gpu_display, pass_mode, num_samples)) {
       return;
diff --git a/intern/cycles/integrator/render_scheduler.cpp 
b/intern/cycles/integrator/render_scheduler.cpp
index d996aefa766..5ab671933b2 100644
--- a/intern/cycles/integrator/render_scheduler.cpp
+++ b/intern/cycles/integrator/render_scheduler.cpp
@@ -255,8 +255,12 @@ void 
RenderScheduler::render_work_reschedule_on_cancel(RenderWork &render_work)
    * Allows to have latest state of tile visible while full buffer is being 
processed.
    *
    * Note that if there are no samples in the current tile its render buffer 
might have pixels
-   * remained from previous state. */
-  if (has_rendered_samples) {
+   * remained from previous state.
+   *
+   * If the full result was written, then there is no way any updates were 
made to the render
+   * buffers. And the buffers might have been freed from the device, so 
display update is not
+   * possible. */
+  if (has_rendered_samples && !state_.full_frame_was_written) {
     render_work.update_display = true;
   }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to