[Bf-blender-cvs] [79c2581bfaf] master: Fix T78238: issue loading existing .blend files with Optix viewport denoiser

Brecht Van Lommel noreply at git.blender.org
Thu Jun 25 15:49:21 CEST 2020


Commit: 79c2581bfaf0612f44c44cd09533fc8d231a2d49
Author: Brecht Van Lommel
Date:   Thu Jun 25 15:14:30 2020 +0200
Branches: master
https://developer.blender.org/rB79c2581bfaf0612f44c44cd09533fc8d231a2d49

Fix T78238: issue loading existing .blend files with Optix viewport denoiser

Also add additional validation to ensure the denoiser is supported before
trying to use it.

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

M	intern/cycles/render/session.cpp
M	source/blender/blenloader/intern/versioning_cycles.c

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

diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 8c36d34aeea..1a94d3e9db7 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -61,8 +61,10 @@ Session::Session(const SessionParams &params_)
 
   TaskScheduler::init(params.threads);
 
+  /* Create CPU/GPU devices. */
   device = Device::create(params.device, stats, profiler, params.background);
 
+  /* Create buffers for interactive rendering. */
   if (params.background && !params.write_render_cb) {
     buffers = NULL;
     display = NULL;
@@ -72,6 +74,9 @@ Session::Session(const SessionParams &params_)
     display = new DisplayBuffer(device, params.display_buffer_linear);
   }
 
+  /* Validate denoising parameters. */
+  set_denoising(params.denoising);
+
   session_thread = NULL;
   scene = NULL;
 
@@ -944,17 +949,21 @@ void Session::set_pause(bool pause_)
 
 void Session::set_denoising(const DenoiseParams &denoising)
 {
-  const bool need_denoise = denoising.need_denoising_task();
-
-  if (need_denoise && !(params.device.denoisers & denoising.type)) {
-    progress.set_error("Denoiser type not supported by compute device");
-    return;
-  }
+  bool need_denoise = denoising.need_denoising_task();
 
   /* Lock buffers so no denoising operation is triggered while the settings are changed here. */
   thread_scoped_lock buffers_lock(buffers_mutex);
   params.denoising = denoising;
 
+  if (!(params.device.denoisers & denoising.type)) {
+    if (need_denoise) {
+      progress.set_error("Denoiser type not supported by compute device");
+    }
+
+    params.denoising.use = false;
+    need_denoise = false;
+  }
+
   // TODO(pmours): Query the required overlap value for denoising from the device?
   tile_manager.slice_overlap = need_denoise && !params.background ? 64 : 0;
 
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c
index 72ee4c5ec4d..46faddf6e5a 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -1568,6 +1568,7 @@ void do_versions_after_linking_cycles(Main *bmain)
       }
 
       if (cscene) {
+        const int DENOISER_AUTO = 0;
         const int DENOISER_NLM = 1;
         const int DENOISER_OPTIX = 2;
 
@@ -1578,7 +1579,7 @@ void do_versions_after_linking_cycles(Main *bmain)
         /* Migrate Optix denoiser to new settings. */
         if (cycles_property_int(cscene, "preview_denoising", 0)) {
           cycles_property_boolean_set(cscene, "use_preview_denoising", true);
-          cycles_property_boolean_set(cscene, "preview_denoiser", DENOISER_OPTIX);
+          cycles_property_int_set(cscene, "preview_denoiser", DENOISER_AUTO);
         }
       }



More information about the Bf-blender-cvs mailing list