[Bf-blender-cvs] [6bf7e2868f0] cycles_path_guiding: Guiding: various changes to debug passes

Brecht Van Lommel noreply at git.blender.org
Thu Aug 11 17:12:50 CEST 2022


Commit: 6bf7e2868f05951beb1ace3c715c6dce21c91766
Author: Brecht Van Lommel
Date:   Thu Aug 11 15:59:37 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB6bf7e2868f05951beb1ace3c715c6dce21c91766

Guiding: various changes to debug passes

* Remove OpenPGL from the name, use just Guiding instead
* Enable using WITH_CYCLES_DEBUG option instead of separate define
* Fix wrong PASS_CATEGORY_DATA_END (is blocks of 32 passes for bitflags)

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

M	intern/cycles/CMakeLists.txt
M	intern/cycles/blender/sync.cpp
M	intern/cycles/integrator/path_trace_work_cpu.cpp
M	intern/cycles/kernel/data_template.h
M	intern/cycles/kernel/integrator/guiding.h
M	intern/cycles/kernel/integrator/shade_surface.h
M	intern/cycles/kernel/types.h
M	intern/cycles/scene/film.cpp
M	intern/cycles/scene/pass.cpp

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

diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index ae802a7bd8f..c3a3bae1007 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -352,7 +352,6 @@ if(WITH_CYCLES_PATH_GUIDING)
   add_definitions(-DWITH_PATH_GUIDING_DEBUG_PRINT)
   add_definitions(-DPATH_GUIDING_LEVEL=5)
   add_definitions(-DPATH_GUIDING_PHASE_FUNCTION_PRODUCT)
-  add_definitions(-DPATH_GUIDING_DEBUG_PASS)
   add_definitions(-DPATH_GUIDING_DEBUG_VALIDATE)
   include_directories(
     SYSTEM
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 640672425eb..c2fdef3938e 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -743,15 +743,15 @@ void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_v
     pass_add(scene, PASS_DENOISING_DEPTH, "Denoising Depth", PassMode::NOISY);
   }
 
-#if defined(WITH_PATH_GUIDING) && defined(PATH_GUIDING_DEBUG_PASS)
-  b_engine.add_pass("OpenPGL Color", 3, "RGB", b_view_layer.name().c_str());
-  pass_add(scene, PASS_OPGL_COLOR, "OpenPGL Color", PassMode::NOISY);
+#ifdef WITH_CYCLES_DEBUG
+  b_engine.add_pass("Guiding Color", 3, "RGB", b_view_layer.name().c_str());
+  pass_add(scene, PASS_GUIDING_COLOR, "Guiding Color", PassMode::NOISY);
 
-  b_engine.add_pass("OpenPGL Guiding Prob", 1, "X", b_view_layer.name().c_str());
-  pass_add(scene, PASS_OPGL_GUIDING_PROB, "OpenPGL Guiding Prob", PassMode::NOISY);
+  b_engine.add_pass("Guiding Probability", 1, "X", b_view_layer.name().c_str());
+  pass_add(scene, PASS_GUIDING_PROBABILITY, "Guiding Probability", PassMode::NOISY);
 
-  b_engine.add_pass("OpenPGL Avg Roughness", 1, "X", b_view_layer.name().c_str());
-  pass_add(scene, PASS_OPGL_AVG_ROUGHNESS, "OpenPGL Avg Roughness", PassMode::NOISY);
+  b_engine.add_pass("Guiding Average Roughness", 1, "X", b_view_layer.name().c_str());
+  pass_add(scene, PASS_GUIDING_AVG_ROUGHNESS, "Guiding Average Roughness", PassMode::NOISY);
 #endif
 
   /* Custom AOV passes. */
diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp b/intern/cycles/integrator/path_trace_work_cpu.cpp
index 2043049f958..2f0219b29c3 100644
--- a/intern/cycles/integrator/path_trace_work_cpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_cpu.cpp
@@ -362,7 +362,7 @@ void PathTraceWorkCPU::guiding_push_sample_data_to_global_storage(
     std::cout << "!!! validSegments = " << validSegments << " !!!" << std::endl;
 #    endif
 
-#    if defined(PATH_GUIDING_DEBUG_PASS) && PATH_GUIDING_LEVEL >= 5
+#    if defined(WITH_CYCLES_DEBUG) && PATH_GUIDING_LEVEL >= 5
   // guiding_write_pixel_estimate_buffer(kg, state, render_buffer);
 
   pgl_vec3f pgl_final_color = state->guiding.path_segment_storage->CalculatePixelEstimate(false);
@@ -374,6 +374,8 @@ void PathTraceWorkCPU::guiding_push_sample_data_to_global_storage(
   if (kernel_data.film.pass_opgl_color != PASS_UNUSED) {
     kernel_write_pass_float3(buffer + kernel_data.film.pass_opgl_color, final_color);
   }
+#    else
+  (void)render_buffer;
 #    endif
 #    if PATH_GUIDING_LEVEL >= 2
   /* Converting the path segment representation of the random walk into radiance samples. */
diff --git a/intern/cycles/kernel/data_template.h b/intern/cycles/kernel/data_template.h
index d4bbaa0fcb9..589d7e8db8e 100644
--- a/intern/cycles/kernel/data_template.h
+++ b/intern/cycles/kernel/data_template.h
@@ -133,12 +133,10 @@ KERNEL_STRUCT_MEMBER(film, int, pass_bake_primitive)
 KERNEL_STRUCT_MEMBER(film, int, pass_bake_differential)
 /* Shadow catcher. */
 KERNEL_STRUCT_MEMBER(film, int, use_approximate_shadow_catcher)
-#if 1
 /* Path Guiding */
-KERNEL_STRUCT_MEMBER(film, int, pass_opgl_color)
-KERNEL_STRUCT_MEMBER(film, int, pass_opgl_guiding_prob)
-KERNEL_STRUCT_MEMBER(film, int, pass_opgl_avg_roughness)
-#endif
+KERNEL_STRUCT_MEMBER(film, int, pass_guiding_color)
+KERNEL_STRUCT_MEMBER(film, int, pass_guiding_probability)
+KERNEL_STRUCT_MEMBER(film, int, pass_guiding_avg_roughness)
 /* Padding. */
 KERNEL_STRUCT_MEMBER(film, int, pad1)
 KERNEL_STRUCT_MEMBER(film, int, pad2)
diff --git a/intern/cycles/kernel/integrator/guiding.h b/intern/cycles/kernel/integrator/guiding.h
index c68ff7a8487..f9a7f3e8f69 100644
--- a/intern/cycles/kernel/integrator/guiding.h
+++ b/intern/cycles/kernel/integrator/guiding.h
@@ -3,7 +3,7 @@
 
 #pragma once
 
-#if defined(PATH_GUIDING_DEBUG_PASS)
+#ifdef WITH_CYCLES_DEBUG
 #  include "kernel/closure/alloc.h"
 #  include "kernel/closure/bsdf.h"
 #  include "kernel/film/write_passes.h"
@@ -246,7 +246,7 @@ ccl_device_forceinline void guiding_set_continuation_probability(
 
 #  endif
 
-#  if defined(PATH_GUIDING_DEBUG_PASS)
+#  ifdef WITH_CYCLES_DEBUG
 /* Functions for writing guiding related debug information into separate frame buffers*/
 
 ccl_device_forceinline void guiding_write_guiding_prob_buffer(const KernelGlobalsCPU *kg,
@@ -260,8 +260,8 @@ ccl_device_forceinline void guiding_write_guiding_prob_buffer(const KernelGlobal
                                           kernel_data.film.pass_stride;
     ccl_global float *buffer = render_buffer + render_buffer_offset;
     float guiding_prob = state->guiding.surface_guiding_sampling_prob;
-    if (kernel_data.film.pass_opgl_guiding_prob != PASS_UNUSED) {
-      kernel_write_pass_float(buffer + kernel_data.film.pass_opgl_guiding_prob, guiding_prob);
+    if (kernel_data.film.pass_guiding_probability != PASS_UNUSED) {
+      kernel_write_pass_float(buffer + kernel_data.film.pass_guiding_probability, guiding_prob);
     }
   }
 }
@@ -291,8 +291,8 @@ ccl_device_forceinline void guiding_write_avg_roughness_buffer(const KernelGloba
 
     avg_roughness = avg_roughness > 0.f ? avg_roughness / sum_sample_weight : 0.f;
 
-    if (kernel_data.film.pass_opgl_avg_roughness != PASS_UNUSED) {
-      kernel_write_pass_float(buffer + kernel_data.film.pass_opgl_avg_roughness, avg_roughness);
+    if (kernel_data.film.pass_guiding_avg_roughness != PASS_UNUSED) {
+      kernel_write_pass_float(buffer + kernel_data.film.pass_guiding_avg_roughness, avg_roughness);
     }
   }
 }
diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h
index bf1e62d0252..ba60d54ddff 100644
--- a/intern/cycles/kernel/integrator/shade_surface.h
+++ b/intern/cycles/kernel/integrator/shade_surface.h
@@ -742,7 +742,7 @@ ccl_device bool integrate_surface(KernelGlobals kg,
 
 #if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
     shader_prepare_surface_guiding(kg, state, &sd, &rng_state);
-#  if defined(PATH_GUIDING_DEBUG_PASS)
+#  if defined(WITH_CYCLES_DEBUG)
     const bool use_guiding = kernel_data.integrator.use_guiding;
     if (use_guiding) {
       guiding_write_guiding_prob_buffer(kg, state, render_buffer);
diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h
index bee2293a40f..fb19af343ae 100644
--- a/intern/cycles/kernel/types.h
+++ b/intern/cycles/kernel/types.h
@@ -397,14 +397,11 @@ typedef enum PassType {
   PASS_SHADOW_CATCHER,
   PASS_SHADOW_CATCHER_SAMPLE_COUNT,
   PASS_SHADOW_CATCHER_MATTE,
-#if defined(WITH_PATH_GUIDING) && defined(PATH_GUIDING_DEBUG_PASS)
-  PASS_OPGL_COLOR,
-  PASS_OPGL_GUIDING_PROB,
-  PASS_OPGL_AVG_ROUGHNESS,
-  PASS_CATEGORY_DATA_END = 66,
-#else
+
+  PASS_GUIDING_COLOR,
+  PASS_GUIDING_PROBABILITY,
+  PASS_GUIDING_AVG_ROUGHNESS,
   PASS_CATEGORY_DATA_END = 63,
-#endif
 
   PASS_BAKE_PRIMITIVE,
   PASS_BAKE_DIFFERENTIAL,
diff --git a/intern/cycles/scene/film.cpp b/intern/cycles/scene/film.cpp
index 745f613365f..41ae73b2f27 100644
--- a/intern/cycles/scene/film.cpp
+++ b/intern/cycles/scene/film.cpp
@@ -200,11 +200,9 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
   kfilm->pass_shadow_catcher_sample_count = PASS_UNUSED;
   kfilm->pass_shadow_catcher_matte = PASS_UNUSED;
 
-#if defined(WITH_PATH_GUIDING) && defined(PATH_GUIDING_DEBUG_PASS)
-  kfilm->pass_opgl_color = PASS_UNUSED;
-  kfilm->pass_opgl_guiding_prob = PASS_UNUSED;
-  kfilm->pass_opgl_avg_roughness = PASS_UNUSED;
-#endif
+  kfilm->pass_guiding_color = PASS_UNUSED;
+  kfilm->pass_guiding_probability = PASS_UNUSED;
+  kfilm->pass_guiding_avg_roughness = PASS_UNUSED;
 
   bool have_cryptomatte = false;
   bool have_aov_color = false;
@@ -388,17 +386,15 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
           have_aov_value = true;
         }
         break;
-#if defined(WITH_PATH_GUIDING) && defined(PATH_GUIDING_DEBUG_PASS)
-      case PASS_OPGL_COLOR:
-        kfilm->pass_opgl_color = kfilm->pass_stride;
+      case PASS_GUIDING_COLOR:
+        kfilm->pass_guiding_color = kfilm->pass_stride;
         break;
-      case PASS_OPGL_GUIDING_PROB:
-        kfilm->pass_opgl_guiding_prob = kfilm->pass_stride;
+      case PASS_GUIDING_PROBABILITY:
+        kfilm->pass_guiding_probability = kfilm->pass_stride;
         break;
-      case PASS_OPGL_AVG_ROUGHNESS:
-        kfilm->pass_opgl_avg_roughness = kfilm->pass_stride;
+      case PASS_GUIDING_AVG_ROUGHNESS:
+        kfilm->pass_guiding_avg_roughness = kfilm->pass_stride;
         break;
-#endif
       default:
         assert(false);
         break;
diff --git a/intern/cycles/scene/pass.cpp b/intern/cycles/scene/pass.cpp
index c4b1bc693fb..5833b45c409 100644
--- a/intern/cycles/scene/pass.cpp
+++ b/intern/cycles/scene/pass.cpp
@@ -96,10 +96,11 @@ const NodeEnum *Pass::get_type_enum()
 
     pass_type_enum.insert("bake_primitive", PASS_BAKE_PRIMITIVE);
     pass_type_enum.insert("bake_differential", PASS_BAKE_DIFFERENTIAL);
-#if defined(WITH_PATH_GUIDING) && defined(PATH_GUIDING_DEBUG_PASS)
-    pass_type_enum.insert("opgl_color", PASS_OPGL_COLOR);
-    pass_type_enum.insert("opgl_guiding_prob", PASS_OPGL_GUIDING_PROB);
-    pass_type_enum.insert("opgl_avg_roughness", PASS_OPGL_AVG_ROUGHNESS);
+
+#ifdef WITH_CYCLES_DEBUG
+    pass_type_enum.insert("guiding_color", PASS_GUIDING_COLOR);
+    pass_type_enum.insert("guiding_probability", PASS_GUIDING_PROBABILITY);
+    pass_type_enum.insert("guiding_avg_roughness", PASS_GUIDING_AVG_ROUGHNESS);
 #endif
   }
 
@@ -346,17 +347,15 @@ PassInfo Pass::get_info(const PassType type, const bool include_albedo, const bo
       LOG(DFATAL) << "Unexpected pass type i

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list