[Bf-blender-cvs] [e314f7d5f48] soc-2022-many-lights-sampling: Fix light_tree_sample errors when a light isn't selected

Alaska noreply at git.blender.org
Fri Oct 7 14:11:44 CEST 2022


Commit: e314f7d5f48d8b0745d2ce022e249b34f9f31d47
Author: Alaska
Date:   Fri Oct 7 13:30:21 2022 +0200
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBe314f7d5f48d8b0745d2ce022e249b34f9f31d47

Fix light_tree_sample errors when a light isn't selected

Under certain conditions it is possible for a light to not be selected
in the light_tree_sample function. This lead to errors in other areas
of the code.

This patch attempts to fix this issue by checking for the situation
that a light wasn't selected.

Differential Revision: https://developer.blender.org/D16089

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

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 35f41e7e687..e2318675d57 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -383,7 +383,7 @@ ccl_device bool light_tree_sample(KernelGlobals kg,
     }
   }
 
-  if (total_weight == 0.0f) {
+  if (total_weight == 0.0f || current_light < 0) {
     return false;
   }



More information about the Bf-blender-cvs mailing list