[Bf-blender-cvs] [f37c12f803d] soc-2020-production-ready-light-tree: Fixed most render tests with light tree off.

Sam Kottler noreply at git.blender.org
Tue Jun 16 18:13:24 CEST 2020


Commit: f37c12f803d55113b1bdd303bf7d14aab4d97fdc
Author: Sam Kottler
Date:   Tue Jun 16 10:13:06 2020 -0600
Branches: soc-2020-production-ready-light-tree
https://developer.blender.org/rBf37c12f803d55113b1bdd303bf7d14aab4d97fdc

Fixed most render tests with light tree off.

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

M	intern/cycles/kernel/kernel_light.h
M	intern/cycles/kernel/kernel_path.h
M	intern/cycles/kernel/kernel_path_branched.h
M	intern/cycles/kernel/kernel_path_surface.h
M	intern/cycles/kernel/kernel_volume.h
M	intern/cycles/kernel/split/kernel_do_volume.h
M	release/scripts/addons

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

diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index cea1656ede6..d470d340b85 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -42,25 +42,29 @@ typedef struct LightSample {
  * importance for the lights in the lower hemisphere. This is done by setting
  * the normal to either [0,0,0] to indicate that it should not be used in the
  * importance calculations or to flip the normal if we know it must refract. */
-ccl_device void kernel_update_light_picking(ShaderData *sd, ccl_addr_space PathState *state)
+ccl_device void kernel_update_light_picking(KernelGlobals *kg,
+                                            ShaderData *sd,
+                                            ccl_addr_space PathState *state)
 {
   bool transmission = false;
   bool reflective = false;
   bool glass = false;
   bool transparent = false;
-  for (int i = 0; i < sd->num_closure; ++i) {
-    const ShaderClosure *sc = &sd->closure[i];
-    if (CLOSURE_IS_GLASS(sc->type)) {
-      glass = true;
-    }
-    if (CLOSURE_IS_BSDF_TRANSMISSION(sc->type)) {
-      transmission = true;
-    }
-    if (CLOSURE_IS_BSDF_DIFFUSE(sc->type) || CLOSURE_IS_BSDF_GLOSSY(sc->type)) {
-      reflective = true;
-    }
-    if (CLOSURE_IS_BSDF_TRANSPARENT(sc->type)) {
-      transparent = true;
+  if (sd->num_closure < kernel_data.integrator.max_closures) {
+    for (int i = 0; i < sd->num_closure; ++i) {
+      const ShaderClosure *sc = &sd->closure[i];
+      if (CLOSURE_IS_GLASS(sc->type)) {
+        glass = true;
+      }
+      if (CLOSURE_IS_BSDF_TRANSMISSION(sc->type)) {
+        transmission = true;
+      }
+      if (CLOSURE_IS_BSDF_DIFFUSE(sc->type) || CLOSURE_IS_BSDF_GLOSSY(sc->type)) {
+        reflective = true;
+      }
+      if (CLOSURE_IS_BSDF_TRANSPARENT(sc->type)) {
+        transparent = true;
+      }
     }
   }
 
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index acd7b9b3816..af9833385b4 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -108,8 +108,9 @@ ccl_device_forceinline void kernel_path_lamp_emission(KernelGlobals *kg,
       N_pick = state->ray_N;
     }
 
+    state->ray_t += isect->t;
     light_ray.D = ray->D;
-    light_ray.t = state->ray_t + isect->t;
+    light_ray.t = state->ray_t;
     light_ray.time = ray->time;
     light_ray.dD = ray->dD;
     light_ray.dP = ray->dP;
@@ -193,7 +194,7 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume(KernelGlobals *k
     shader_setup_from_volume(kg, sd, &volume_ray);
     kernel_volume_decoupled_record(kg, state, &volume_ray, sd, &volume_segment, step_size);
 
-    kernel_update_light_picking(sd, state);
+    kernel_update_light_picking(kg, sd, state);
 
     volume_segment.sampling_method = sampling_method;
 
@@ -241,7 +242,7 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume(KernelGlobals *k
     VolumeIntegrateResult result = kernel_volume_integrate(
         kg, state, sd, &volume_ray, L, throughput, step_size);
 
-    kernel_update_light_picking(sd, state);
+    kernel_update_light_picking(kg, sd, state);
 
 #    ifdef __VOLUME_SCATTER__
     if (result == VOLUME_PATH_SCATTERED) {
@@ -497,7 +498,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
           throughput /= probability;
         }
 
-        kernel_update_light_picking(sd, state);
+        kernel_update_light_picking(kg, sd, state);
 #    ifdef __DENOISING_FEATURES__
         kernel_update_denoising_features(kg, sd, state, L);
 #    endif
@@ -637,7 +638,7 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
           throughput /= probability;
         }
 
-        kernel_update_light_picking(&sd, state);
+        kernel_update_light_picking(kg, &sd, state);
 
 #  ifdef __DENOISING_FEATURES__
         kernel_update_denoising_features(kg, &sd, state, L);
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h
index 64da8c0b83a..b3010cc03c5 100644
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@ -102,7 +102,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
     shader_setup_from_volume(kg, sd, &volume_ray);
     kernel_volume_decoupled_record(kg, state, &volume_ray, sd, &volume_segment, step_size);
 
-    kernel_update_light_picking(sd, state);
+    kernel_update_light_picking(kg, sd, state);
 
     /* direct light sampling */
     if (volume_segment.closure_flag & SD_SCATTER) {
@@ -177,7 +177,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
       VolumeIntegrateResult result = kernel_volume_integrate(
           kg, &ps, sd, &volume_ray, L, &tp, step_size);
 
-      kernel_update_light_picking(sd, &ps);
+      kernel_update_light_picking(kg, sd, &ps);
 
 #      ifdef __VOLUME_SCATTER__
       if (result == VOLUME_PATH_SCATTERED) {
@@ -457,7 +457,7 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg,
         }
       }
 
-      kernel_update_light_picking(&sd, &state);
+      kernel_update_light_picking(kg, &sd, &state);
 
 #    ifdef __DENOISING_FEATURES__
       kernel_update_denoising_features(kg, &sd, &state, L);
diff --git a/intern/cycles/kernel/kernel_path_surface.h b/intern/cycles/kernel/kernel_path_surface.h
index 24421c4bdc0..09672f542da 100644
--- a/intern/cycles/kernel/kernel_path_surface.h
+++ b/intern/cycles/kernel/kernel_path_surface.h
@@ -593,7 +593,7 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg,
 
     /* setup ray */
     ray->P = ray_offset(sd->P, (label & LABEL_TRANSMIT) ? -sd->Ng : sd->Ng);
-    kernel_update_light_picking(sd, state);
+    kernel_update_light_picking(kg, sd, state);
     ray->D = normalize(bsdf_omega_in);
 
     if (state->bounce == 0)
@@ -626,7 +626,7 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg,
 
     /* setup ray position, direction stays unchanged */
     ray->P = ray_offset(sd->P, -sd->Ng);
-    kernel_update_light_picking(sd, state);
+    kernel_update_light_picking(kg, sd, state);
 
 #  ifdef __RAY_DIFFERENTIALS__
     ray->dP = sd->dP;
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h
index b2468b196da..0ce4947efc7 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -1125,7 +1125,7 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(KernelGlobals *
   /* move to new position */
   sd->P = ray->P + sample_t * ray->D;
 
-  kernel_update_light_picking(sd, state);
+  kernel_update_light_picking(kg, sd, state);
 
   return VOLUME_PATH_SCATTERED;
 }
diff --git a/intern/cycles/kernel/split/kernel_do_volume.h b/intern/cycles/kernel/split/kernel_do_volume.h
index 99a7973019e..14c5d3fe7d0 100644
--- a/intern/cycles/kernel/split/kernel_do_volume.h
+++ b/intern/cycles/kernel/split/kernel_do_volume.h
@@ -63,7 +63,7 @@ ccl_device_noinline bool kernel_split_branched_path_volume_indirect_light_iter(K
     VolumeIntegrateResult result = kernel_volume_integrate(
         kg, ps, sd, &volume_ray, L, tp, step_size);
 
-    kernel_update_light_picking(sd, ps);
+    kernel_update_light_picking(kg, sd, ps);
 
 #  ifdef __VOLUME_SCATTER__
     if (result == VOLUME_PATH_SCATTERED) {
diff --git a/release/scripts/addons b/release/scripts/addons
index 084eec36977..ba2521b7ed1 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 084eec36977c9a084aa020031f4a1aa0f0352170
+Subproject commit ba2521b7ed14b5deb6bb9a82a442bc85d2e05224



More information about the Bf-blender-cvs mailing list