[Bf-blender-cvs] [3c9a3ea9920] cycles_path_guiding: Guiding: don't allocate integrator state for GPU

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


Commit: 3c9a3ea992097aaece7d8a7c4af8fc3d21564ef5
Author: Brecht Van Lommel
Date:   Thu Aug 11 14:47:47 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB3c9a3ea992097aaece7d8a7c4af8fc3d21564ef5

Guiding: don't allocate integrator state for GPU

Using new KERNEL_FEATURE_PATH_GUIDING. Also ensure guiding gets disabled
in the integrator if the device does not support it.

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

M	intern/cycles/device/cpu/device.cpp
M	intern/cycles/device/device.cpp
M	intern/cycles/device/device.h
M	intern/cycles/kernel/integrator/shadow_state_template.h
M	intern/cycles/kernel/integrator/state_template.h
M	intern/cycles/kernel/types.h
M	intern/cycles/scene/integrator.cpp
M	intern/cycles/scene/integrator.h
M	intern/cycles/scene/scene.cpp
M	intern/cycles/session/session.cpp

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

diff --git a/intern/cycles/device/cpu/device.cpp b/intern/cycles/device/cpu/device.cpp
index 5ae0130785b..9505bf1a956 100644
--- a/intern/cycles/device/cpu/device.cpp
+++ b/intern/cycles/device/cpu/device.cpp
@@ -27,6 +27,11 @@ void device_cpu_info(vector<DeviceInfo> &devices)
   info.has_osl = true;
   info.has_nanovdb = true;
   info.has_profiling = true;
+#ifdef WITH_PATH_GUIDING
+  info.has_guiding = true;
+#else
+  info.has_guiding = false;
+#endif
   if (openimagedenoise_supported()) {
     info.denoisers |= DENOISER_OPENIMAGEDENOISE;
   }
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index ace6ed517f5..6aef5458246 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -352,6 +352,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
 
   info.has_nanovdb = true;
   info.has_osl = true;
+  info.has_guiding = true;
   info.has_profiling = true;
   info.has_peer_memory = false;
   info.use_metalrt = false;
@@ -399,6 +400,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
     /* Accumulate device info. */
     info.has_nanovdb &= device.has_nanovdb;
     info.has_osl &= device.has_osl;
+    info.has_guiding &= device.has_guiding;
     info.has_profiling &= device.has_profiling;
     info.has_peer_memory |= device.has_peer_memory;
     info.use_metalrt |= device.use_metalrt;
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 2203372f690..7953040a83f 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -66,6 +66,7 @@ class DeviceInfo {
   bool display_device;        /* GPU is used as a display device. */
   bool has_nanovdb;           /* Support NanoVDB volumes. */
   bool has_osl;               /* Support Open Shading Language. */
+  bool has_guiding;           /* Support path guiding. */
   bool has_profiling;         /* Supports runtime collection of profiling info. */
   bool has_peer_memory;       /* GPU has P2P access to memory of another GPU. */
   bool has_gpu_queue;         /* Device supports GPU queue. */
@@ -84,6 +85,7 @@ class DeviceInfo {
     display_device = false;
     has_nanovdb = false;
     has_osl = false;
+    has_guiding = false;
     has_profiling = false;
     has_peer_memory = false;
     has_gpu_queue = false;
diff --git a/intern/cycles/kernel/integrator/shadow_state_template.h b/intern/cycles/kernel/integrator/shadow_state_template.h
index 21f86fc5712..8aa9ed9e30e 100644
--- a/intern/cycles/kernel/integrator/shadow_state_template.h
+++ b/intern/cycles/kernel/integrator/shadow_state_template.h
@@ -44,17 +44,17 @@ KERNEL_STRUCT_MEMBER(shadow_path, uint8_t, lightgroup, KERNEL_FEATURE_PATH_TRACI
 KERNEL_STRUCT_MEMBER(shadow_path,
                      PackedSpectrum,
                      scattered_contribution,
-                     KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
 KERNEL_STRUCT_MEMBER(shadow_path,
                      openpgl::cpp::PathSegment *,
                      path_segment,
-                     KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
 #else
 KERNEL_STRUCT_MEMBER(shadow_path,
                      PackedSpectrum,
                      scattered_contribution,
-                     KERNEL_FEATURE_PATH_TRACING)
-KERNEL_STRUCT_MEMBER(shadow_path, void *, path_segment, KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
+KERNEL_STRUCT_MEMBER(shadow_path, void *, path_segment, KERNEL_FEATURE_PATH_GUIDING)
 #endif
 KERNEL_STRUCT_END(shadow_path)
 
diff --git a/intern/cycles/kernel/integrator/state_template.h b/intern/cycles/kernel/integrator/state_template.h
index 7d63180bc20..090416c7c3a 100644
--- a/intern/cycles/kernel/integrator/state_template.h
+++ b/intern/cycles/kernel/integrator/state_template.h
@@ -48,7 +48,7 @@ KERNEL_STRUCT_MEMBER(path, float, continuation_probability, KERNEL_FEATURE_PATH_
 /* Throughput. */
 KERNEL_STRUCT_MEMBER(path, PackedSpectrum, throughput, KERNEL_FEATURE_PATH_TRACING)
 /* Throughput used for making Russian Roulette decisions. */
-KERNEL_STRUCT_MEMBER(path, PackedSpectrum, rr_throughput, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(path, PackedSpectrum, rr_throughput, KERNEL_FEATURE_PATH_GUIDING)
 /* Ratio of throughput to distinguish diffuse / glossy / transmission render passes. */
 KERNEL_STRUCT_MEMBER(path, PackedSpectrum, pass_diffuse_weight, KERNEL_FEATURE_LIGHT_PASSES)
 KERNEL_STRUCT_MEMBER(path, PackedSpectrum, pass_glossy_weight, KERNEL_FEATURE_LIGHT_PASSES)
@@ -110,65 +110,65 @@ KERNEL_STRUCT_BEGIN(guiding)
 KERNEL_STRUCT_MEMBER(guiding,
                      openpgl::cpp::PathSegmentStorage *,
                      path_segment_storage,
-                     KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
 /* Current path segment of the random walk/path. */
 KERNEL_STRUCT_MEMBER(guiding,
                      openpgl::cpp::PathSegment *,
                      path_segment,
-                     KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
 /* Guided sampling distribution for sampling new directions at a position on a surface. */
 KERNEL_STRUCT_MEMBER(guiding,
                      openpgl::cpp::SurfaceSamplingDistribution *,
                      surface_sampling_distribution,
-                     KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
 /* Guided sampling distribution for sampling new directions at position inside a volume. */
 KERNEL_STRUCT_MEMBER(guiding,
                      openpgl::cpp::VolumeSamplingDistribution *,
                      volume_sampling_distribution,
-                     KERNEL_FEATURE_PATH_TRACING)
+                     KERNEL_FEATURE_PATH_GUIDING)
 /* If surface guiding is enabled */
-KERNEL_STRUCT_MEMBER(guiding, bool, use_surface_guiding, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, bool, use_surface_guiding, KERNEL_FEATURE_PATH_GUIDING)
 /* Random number used for additional guiding decisions (e.g., cache query, selection to use guiding
  * or bsdf sampling) */
-KERNEL_STRUCT_MEMBER(guiding, float, sample_surface_guiding_rand, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, sample_surface_guiding_rand, KERNEL_FEATURE_PATH_GUIDING)
 /* The probability to use surface guiding (i.e., diffuse sampling prob * guiding prob)*/
-KERNEL_STRUCT_MEMBER(guiding, float, surface_guiding_sampling_prob, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, surface_guiding_sampling_prob, KERNEL_FEATURE_PATH_GUIDING)
 /* Probability of sampling a bssrdf closure instead of a bsdf closure*/
-KERNEL_STRUCT_MEMBER(guiding, float, bssrdf_sampling_prob, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, bssrdf_sampling_prob, KERNEL_FEATURE_PATH_GUIDING)
 /* If volume guiding is enabled */
-KERNEL_STRUCT_MEMBER(guiding, bool, use_volume_guiding, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, bool, use_volume_guiding, KERNEL_FEATURE_PATH_GUIDING)
 /* Random number used for additional guiding decisions (e.g., cache query, selection to use guiding
  * or bsdf sampling) */
-KERNEL_STRUCT_MEMBER(guiding, float, sample_volume_guiding_rand, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, sample_volume_guiding_rand, KERNEL_FEATURE_PATH_GUIDING)
 /* The probability to use surface guiding (i.e., diffuse sampling prob * guiding prob)*/
-KERNEL_STRUCT_MEMBER(guiding, float, volume_guiding_sampling_prob, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, volume_guiding_sampling_prob, KERNEL_FEATURE_PATH_GUIDING)
 KERNEL_STRUCT_END(guiding)
 #else
 KERNEL_STRUCT_BEGIN(guiding)
 /* Storage container for holding all path segments of the random walk/path. */
-KERNEL_STRUCT_MEMBER(guiding, void *, path_segment_storage, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, void *, path_segment_storage, KERNEL_FEATURE_PATH_GUIDING)
 /* Current path segment of the random walk/path. */
-KERNEL_STRUCT_MEMBER(guiding, void *, path_segment, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, void *, path_segment, KERNEL_FEATURE_PATH_GUIDING)
 /* Guided sampling distribution for sampling new directions at a position on a surface. */
-KERNEL_STRUCT_MEMBER(guiding, void *, surface_sampling_distribution, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, void *, surface_sampling_distribution, KERNEL_FEATURE_PATH_GUIDING)
 /* Guided sampling distribution for sampling new directions at position inside a volume. */
-KERNEL_STRUCT_MEMBER(guiding, void *, volume_sampling_distribution, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, void *, volume_sampling_distribution, KERNEL_FEATURE_PATH_GUIDING)
 /* If surface guiding is enabled */
-KERNEL_STRUCT_MEMBER(guiding, bool, use_surface_guiding, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, bool, use_surface_guiding, KERNEL_FEATURE_PATH_GUIDING)
 /* Random number used for additional guiding decisions (e.g., cache query, selection to use guiding
  * or bsdf sampling) */
-KERNEL_STRUCT_MEMBER(guiding, float, sample_surface_guiding_rand, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, sample_surface_guiding_rand, KERNEL_FEATURE_PATH_GUIDING)
 /* The probability to use surface guiding (i.e., diffuse sampling prob * guiding prob)*/
-KERNEL_STRUCT_MEMBER(guiding, float, surface_guiding_sampling_prob, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, surface_guiding_sampling_prob, KERNEL_FEATURE_PATH_GUIDING)
 /* Probability of sampling a bssrdf closure instead of a bsdf closure*/
-KERNEL_STRUCT_MEMBER(guiding, float, bssrdf_sampling_prob, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, float, bssrdf_sampling_prob, KERNEL_FEATURE_PATH_GUIDING)
 /* If volume guiding is enabled */
-KERNEL_STRUCT_MEMBER(guiding, bool, use_volume_guiding, KERNEL_FEATURE_PATH_TRACING)
+KERNEL_STRUCT_MEMBER(guiding, bool, use_volume_guiding, KERNEL_FEATURE_PATH_GUIDING)
 /* Random number used for additional guiding decisions (e.g., cache query, selection to use guiding
  * or bsdf sa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list