[Bf-blender-cvs] [2946bfb6dc2] soc-2022-many-lights-sampling: Fix wrong return value in distant light sampling, triggering asserts

Brecht Van Lommel noreply at git.blender.org
Thu Oct 20 20:47:24 CEST 2022


Commit: 2946bfb6dc2f8947463b6d5179f96a07dce07b08
Author: Brecht Van Lommel
Date:   Thu Oct 20 20:34:21 2022 +0200
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB2946bfb6dc2f8947463b6d5179f96a07dce07b08

Fix wrong return value in distant light sampling, triggering asserts

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

M	intern/cycles/kernel/light/light_tree.h

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

diff --git a/intern/cycles/kernel/light/light_tree.h b/intern/cycles/kernel/light/light_tree.h
index bbbfa721dc3..1d64d559c69 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -525,7 +525,7 @@ ccl_device bool light_tree_sample_distant_lights(KernelGlobals kg,
   }
 
   if (total_importance == 0.0f) {
-    return -1;
+    return false;
   }
 
   float light_cdf = 0.0f;
@@ -541,7 +541,7 @@ ccl_device bool light_tree_sample_distant_lights(KernelGlobals kg,
       const int lamp = kdistant->prim_id;
 
       if (UNLIKELY(light_select_reached_max_bounces(kg, lamp, bounce))) {
-        return -1;
+        return false;
       }
 
       return light_sample<in_volume_segment>(kg, lamp, *randu, randv, P, path_flag, ls);
@@ -552,7 +552,7 @@ ccl_device bool light_tree_sample_distant_lights(KernelGlobals kg,
   /* TODO: change implementation so that even under precision issues, we always end
    * up selecting a light and this can't happen? */
   kernel_assert(false);
-  return -1;
+  return false;
 }
 
 /* We need to be able to find the probability of selecting a given light for MIS.



More information about the Bf-blender-cvs mailing list