[Bf-blender-cvs] [d0cce099e5c] cycles_path_guiding: Build: don't add PATH_GUIDING_DEBUG defines

Brecht Van Lommel noreply at git.blender.org
Tue Sep 20 21:00:37 CEST 2022


Commit: d0cce099e5c071500b3a88765c1f38142f7b0e7c
Author: Brecht Van Lommel
Date:   Tue Sep 20 18:03:20 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rBd0cce099e5c071500b3a88765c1f38142f7b0e7c

Build: don't add PATH_GUIDING_DEBUG defines

This is a bit excessive, prefer to check WITH_CYCLES_DEBUG directly.

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

M	intern/cycles/CMakeLists.txt
M	intern/cycles/integrator/path_trace.cpp
M	intern/cycles/integrator/path_trace_work_cpu.cpp

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

diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 0a32a9dde0f..e580f134984 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -349,6 +349,7 @@ endif()
 
 if(WITH_CYCLES_PATH_GUIDING)
   add_definitions(-DWITH_PATH_GUIDING)
+
   # The level of the guiding integration. 
   # Different levels can be selected to measure the overhead of 
   # different stages.
@@ -358,14 +359,7 @@ if(WITH_CYCLES_PATH_GUIDING)
   # 4 = 3 + training the guiding fields
   # 5 = 4 + querying the trained guiding for sampling (full path guiding)  
   add_definitions(-DPATH_GUIDING_LEVEL=5)
-  if(WITH_CYCLES_DEBUG)
-    # Validates each generated guiding data structure 
-    # (e.g., PathSegments, SampleData) during rendering. 
-    # This mode comes with a computational overhead.
-    add_definitions(-DPATH_GUIDING_DEBUG_VALIDATE)
-    # Prints some guiding information (e.g., num. training samples per iteration)
-    add_definitions(-DWITH_PATH_GUIDING_DEBUG_PRINT)
-  endif()
+
   include_directories(
     SYSTEM
     ${OPENPGL_INCLUDE_DIR}
diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp
index 4ee30bb0270..e1640bda6af 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -1343,17 +1343,16 @@ void PathTrace::guiding_prepare_structures()
 void PathTrace::guiding_update_structures()
 {
 #ifdef WITH_PATH_GUIDING
-#  ifdef WITH_PATH_GUIDING_DEBUG_PRINT
-  VLOG_INFO << "Path Guiding: update guiding structures";
-  VLOG_INFO << "SampleDataStrorage: #surface samples = "
-            << guiding_sample_data_storage_->GetSizeSurface()
-            << "\t#volumesamples = " << guiding_sample_data_storage_->GetSizeVolume();
-#  endif
+  VLOG_WORK << "Update path guiding structures";
+
+  VLOG_DEBUG << "Number of surface samples: " << guiding_sample_data_storage_->GetSizeSurface();
+  VLOG_DEBUG << "Number of volume samples: " << guiding_sample_data_storage_->GetSizeVolume();
+
   const size_t num_valid_samples = guiding_sample_data_storage_->GetSizeSurface() +
                                    guiding_sample_data_storage_->GetSizeVolume();
+
   /* we wait until we have at least 1024 samples */
   if (num_valid_samples >= 1024) {
-
 #  if OPENPGL_VERSION_MINOR < 4
     const size_t num_samples = 1;
     guiding_field_->Update(*guiding_sample_data_storage_, num_samples);
@@ -1361,9 +1360,9 @@ void PathTrace::guiding_update_structures()
     guiding_field_->Update(*guiding_sample_data_storage_);
 #  endif
     guiding_update_count++;
-#  if defined(WITH_PATH_GUIDING_DEBUG_PRINT) && PATH_GUIDING_DEBUG_VALIDATE
-    VLOG_DEBUG << "Field: valid = " << guiding_field_->Validate();
-#  endif
+
+    VLOG_DEBUG << "Path guiding field valid: " << guiding_field_->Validate();
+
     guiding_sample_data_storage_->Clear();
   }
 #endif
diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp b/intern/cycles/integrator/path_trace_work_cpu.cpp
index db697034576..79d796d0b20 100644
--- a/intern/cycles/integrator/path_trace_work_cpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_cpu.cpp
@@ -359,12 +359,14 @@ void PathTraceWorkCPU::guiding_prepare_integrator_state(KernelGlobalsCPU *kg,
 void PathTraceWorkCPU::guiding_push_sample_data_to_global_storage(
     KernelGlobalsCPU *kg, IntegratorStateCPU *state, ccl_global float *ccl_restrict render_buffer)
 {
-
-#    if defined(PATH_GUIDING_DEBUG_VALIDATE) && PATH_GUIDING_LEVEL >= 5
-  /* Checks if the generated path segments contain valid values */
-  bool validSegments = state->guiding.path_segment_storage->ValidateSegments();
-  if (!validSegments)
-    VLOG_WORK << "Guiding: Invalid path segments!" << std::endl;
+#    if defined(WITH_CYCLES_DEBUG) && PATH_GUIDING_LEVEL >= 5
+  if (VLOG_DEBUG_IS_ON) {
+    /* Checks if the generated path segments contain valid values */
+    const bool validSegments = state->guiding.path_segment_storage->ValidateSegments();
+    if (!validSegments) {
+      VLOG_DEBUG << "Guiding: Invalid path segments!";
+    }
+  }
 #    endif
 
 #    if defined(WITH_CYCLES_DEBUG) && PATH_GUIDING_LEVEL >= 5
@@ -389,13 +391,14 @@ void PathTraceWorkCPU::guiding_push_sample_data_to_global_storage(
       false, nullptr, use_mis_weights, use_guide_direct_light, false);
 #    endif
 
-#    if defined(PATH_GUIDING_DEBUG_VALIDATE) && PATH_GUIDING_LEVEL >= 5
+#    if defined(WITH_CYCLES_DEBUG) && PATH_GUIDING_LEVEL >= 5
   /* Checking if the training/radiance samples generated py the path segment storage are valid.*/
-  bool validSamples = state->guiding.path_segment_storage->ValidateSamples();
-  if (!validSamples)
-    VLOG_WORK
-        << "Guiding: Path segment storage generated/contains invalid radiance/training samples!"
-        << std::endl;
+  if (VLOG_DEBUG_IS_ON) {
+    const bool validSamples = state->guiding.path_segment_storage->ValidateSamples();
+    if (!validSamples)
+      VLOG_DEBUG
+          << "Guiding: Path segment storage generated/contains invalid radiance/training samples!";
+  }
 #    endif
 
 #    if PATH_GUIDING_LEVEL >= 3



More information about the Bf-blender-cvs mailing list