Fix T54105: random walk SSS missing in branched indirect paths.
[blender-staging.git] / intern / cycles / kernel / split / kernel_split_common.h
index 21886ee62ee2e0aebaf9c800617bd1237c2bcbfd..b52e7bddc8294e72c9129dc55c48b257b5d29c49 100644 (file)
@@ -59,7 +59,12 @@ ccl_device_inline void kernel_split_path_end(KernelGlobals *kg, int ray_index)
        ccl_global char *ray_state = kernel_split_state.ray_state;
 
 #ifdef __BRANCHED_PATH__
        ccl_global char *ray_state = kernel_split_state.ray_state;
 
 #ifdef __BRANCHED_PATH__
-       if(IS_FLAG(ray_state, ray_index, RAY_BRANCHED_INDIRECT_SHARED)) {
+       ccl_addr_space SubsurfaceIndirectRays *ss_indirect = &kernel_split_state.ss_rays[ray_index];
+
+       if(ss_indirect->num_rays) {
+               ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER);
+       }
+       else if(IS_FLAG(ray_state, ray_index, RAY_BRANCHED_INDIRECT_SHARED)) {
                int orig_ray = kernel_split_state.branched_state[ray_index].original_ray;
 
                PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
                int orig_ray = kernel_split_state.branched_state[ray_index].original_ray;
 
                PathRadiance *L = &kernel_split_state.path_radiance[ray_index];