[Bf-blender-cvs] [e188bfc8260] cycles-x: Fix Cycles-X GPU rendering and OIDN denoiser

Sergey Sharybin noreply at git.blender.org
Thu Jun 10 12:21:04 CEST 2021


Commit: e188bfc826084c14369fc3e584bcb945b805f923
Author: Sergey Sharybin
Date:   Thu Jun 10 12:18:08 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBe188bfc826084c14369fc3e584bcb945b805f923

Fix Cycles-X GPU rendering and OIDN denoiser

The issue was introduced in the initial baking support commit:
the `RenderBuffers::zero()` does not modify the CPU-size data,
so sequential call to `RenderBuffers::copy_to_device()` will
copy old data to the device.

Solved by not copying data to the device if there is no data
read, which is good thing to do anyway to avoid double data
copy to the device when no new data was provided.

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

M	intern/cycles/integrator/path_trace.cpp
M	intern/cycles/integrator/path_trace.h
M	intern/cycles/render/session.cpp

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

diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp
index 866a4febabd..6f9d93421ae 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -436,8 +436,9 @@ void PathTrace::buffer_read()
     return;
   }
 
-  buffer_read_cb();
-  full_render_buffers_->copy_to_device();
+  if (buffer_read_cb()) {
+    full_render_buffers_->copy_to_device();
+  }
 }
 
 void PathTrace::progress_update_if_needed()
diff --git a/intern/cycles/integrator/path_trace.h b/intern/cycles/integrator/path_trace.h
index b825aecaf37..fb170ad8fb2 100644
--- a/intern/cycles/integrator/path_trace.h
+++ b/intern/cycles/integrator/path_trace.h
@@ -128,7 +128,7 @@ class PathTrace {
   /* Callback which initializes rendered buffer. Is called before pathtracing starts.
    *
    * This is used for baking. */
-  function<void(void)> buffer_read_cb;
+  function<bool(void)> buffer_read_cb;
 
   /* Callback which is called to report current rendering progress.
    *
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 829d0c68f73..9e84fa78aae 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -75,11 +75,12 @@ Session::Session(const SessionParams &params_, const SceneParams &scene_params)
     }
     write_render_tile_cb();
   };
-  path_trace_->buffer_read_cb = [&]() {
+  path_trace_->buffer_read_cb = [&]() -> bool {
     if (!read_render_tile_cb) {
-      return;
+      return false;
     }
     read_render_tile_cb();
+    return true;
   };
   path_trace_->progress_update_cb = [&]() { update_status_time(); };
 }



More information about the Bf-blender-cvs mailing list