[Bf-blender-cvs] [5aa0797d447] cycles-x: Fix static initialization order crash with denoise parameters

Brecht Van Lommel noreply at git.blender.org
Thu Sep 16 19:59:13 CEST 2021


Commit: 5aa0797d447e74eb1eb119f02f7cb7dfdbc1d37e
Author: Brecht Van Lommel
Date:   Thu Sep 16 19:46:20 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB5aa0797d447e74eb1eb119f02f7cb7dfdbc1d37e

Fix static initialization order crash with denoise parameters

Now that DenoiseParams is a Node, we can no longer create an instance of
it when defining the Integrator Node, since that might not have been
registered yet.

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

M	intern/cycles/device/device_denoise.h
M	intern/cycles/render/integrator.cpp

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

diff --git a/intern/cycles/device/device_denoise.h b/intern/cycles/device/device_denoise.h
index 494ff940276..02ee63fb0ad 100644
--- a/intern/cycles/device/device_denoise.h
+++ b/intern/cycles/device/device_denoise.h
@@ -52,7 +52,9 @@ enum DenoiserPrefilter {
   DENOISER_PREFILTER_NUM,
 };
 
-/* NOTE: Is not a real scene node. Using Node API for ease of (de)serialization. */
+/* NOTE: Is not a real scene node. Using Node API for ease of (de)serialization.
+ * The default values here do not really matter as they are always initialized from the
+ * Integrator node. */
 class DenoiseParams : public Node {
  public:
   NODE_DECLARE
@@ -66,11 +68,9 @@ class DenoiseParams : public Node {
   /* Viewport start sample. */
   int start_sample = 0;
 
-  /* Extra passes which are used by the denoiser (the color pass is always used).
-   * Default to color + albedo only, since normal input does not always have the desired effect
-   * when denoising with OptiX. */
+  /* Auxiliry passes. */
   bool use_pass_albedo = true;
-  bool use_pass_normal = false;
+  bool use_pass_normal = true;
 
   DenoiserPrefilter prefilter = DENOISER_PREFILTER_FAST;
 
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index 35a61a663cc..9188a52d9be 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -90,22 +90,16 @@ NODE_DEFINE(Integrator)
   denoiser_prefilter_enum.insert("fast", DENOISER_PREFILTER_FAST);
   denoiser_prefilter_enum.insert("accurate", DENOISER_PREFILTER_ACCURATE);
 
-  /* Construct default parameters, so that they are the source of truth for defaults. */
-  const DenoiseParams default_denoise_params;
-
-  SOCKET_BOOLEAN(use_denoise, "Use Denoiser", default_denoise_params.use);
-  SOCKET_ENUM(denoiser_type, "Denoiser Type", denoiser_type_enum, default_denoise_params.type);
-  SOCKET_INT(denoise_start_sample, "Start Sample to Denoise", default_denoise_params.start_sample);
-  SOCKET_BOOLEAN(use_denoise_pass_albedo,
-                 "Use Albedo Pass for Denoiser",
-                 default_denoise_params.use_pass_albedo);
-  SOCKET_BOOLEAN(use_denoise_pass_normal,
-                 "Use Normal Pass for Denoiser Denoiser",
-                 default_denoise_params.use_pass_normal);
-  SOCKET_ENUM(denoiser_prefilter,
-              "Denoiser Type",
-              denoiser_prefilter_enum,
-              default_denoise_params.prefilter);
+  /* Default to accurate denoising with OpenImageDenoise. For interactive viewport
+   * it's best use OptiX and disable the normal pass since it does not always have
+   * the desired effect for that denoiser. */
+  SOCKET_BOOLEAN(use_denoise, "Use Denoiser", false);
+  SOCKET_ENUM(denoiser_type, "Denoiser Type", denoiser_type_enum, DENOISER_OPENIMAGEDENOISE);
+  SOCKET_INT(denoise_start_sample, "Start Sample to Denoise", 0);
+  SOCKET_BOOLEAN(use_denoise_pass_albedo, "Use Albedo Pass for Denoiser", true);
+  SOCKET_BOOLEAN(use_denoise_pass_normal, "Use Normal Pass for Denoiser", true);
+  SOCKET_ENUM(
+      denoiser_prefilter, "Denoiser Type", denoiser_prefilter_enum, DENOISER_PREFILTER_ACCURATE);
 
   return type;
 }



More information about the Bf-blender-cvs mailing list