[Bf-blender-cvs] [ed2c9afe089] cycles-x: Fix crash with volumes and light intersection

Brecht Van Lommel noreply at git.blender.org
Fri Jul 9 16:17:43 CEST 2021


Commit: ed2c9afe08972a9a96f929a42a4ef884880bf11c
Author: Brecht Van Lommel
Date:   Thu Jul 8 14:19:48 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBed2c9afe08972a9a96f929a42a4ef884880bf11c

Fix crash with volumes and light intersection

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

M	intern/cycles/kernel/integrator/integrator_intersect_closest.h

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

diff --git a/intern/cycles/kernel/integrator/integrator_intersect_closest.h b/intern/cycles/kernel/integrator/integrator_intersect_closest.h
index 39a0cad8c03..ba397c24cb7 100644
--- a/intern/cycles/kernel/integrator/integrator_intersect_closest.h
+++ b/intern/cycles/kernel/integrator/integrator_intersect_closest.h
@@ -30,7 +30,6 @@ CCL_NAMESPACE_BEGIN
 
 template<uint32_t current_kernel>
 ccl_device_forceinline bool integrator_intersect_terminate(INTEGRATOR_STATE_ARGS,
-                                                           const Intersection *ccl_restrict isect,
                                                            const int shader_flags)
 {
 
@@ -142,11 +141,12 @@ ccl_device void integrator_intersect_closest(INTEGRATOR_STATE_ARGS)
 
 #ifdef __VOLUME__
   if (!integrator_state_volume_stack_is_empty(INTEGRATOR_STATE_PASS)) {
-    const int shader = (hit) ? intersection_get_shader(kg, &isect) : SHADER_NONE;
-    const int flags = (hit) ? kernel_tex_fetch(__shaders, shader).flags : 0;
+    const bool hit_surface = hit && !(isect.type & PRIMITIVE_LAMP);
+    const int shader = (hit_surface) ? intersection_get_shader(kg, &isect) : SHADER_NONE;
+    const int flags = (hit_surface) ? kernel_tex_fetch(__shaders, shader).flags : 0;
 
     if (!integrator_intersect_terminate<DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST>(
-            INTEGRATOR_STATE_PASS, &isect, flags)) {
+            INTEGRATOR_STATE_PASS, flags)) {
       /* Continue with volume kernel if we are inside a volume, regardless
        * if we hit anything. */
       INTEGRATOR_PATH_NEXT(DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST,
@@ -172,7 +172,7 @@ ccl_device void integrator_intersect_closest(INTEGRATOR_STATE_ARGS)
       const int flags = kernel_tex_fetch(__shaders, shader).flags;
 
       if (!integrator_intersect_terminate<DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST>(
-              INTEGRATOR_STATE_PASS, &isect, flags)) {
+              INTEGRATOR_STATE_PASS, flags)) {
         integrator_intersect_shader_next_kernel<DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST>(
             INTEGRATOR_STATE_PASS, &isect, shader, flags);
         return;



More information about the Bf-blender-cvs mailing list