[Bf-blender-cvs] [1d149f6746a] blender-v2.82-release: Fix T72470: OptiX render fails with scene with many translucent planes on Linux.

Patrick Mours noreply at git.blender.org
Fri Jan 10 15:48:16 CET 2020


Commit: 1d149f6746a00cb49df202b1c49fcff4264dd226
Author: Patrick Mours
Date:   Fri Jan 10 15:42:44 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB1d149f6746a00cb49df202b1c49fcff4264dd226

Fix T72470: OptiX render fails with scene with many translucent planes on Linux.

OptiX always uses record-all behavior for transparent shadow rays, but did not check
whether the maximum number of hits exceeded the shadow hit stack. This fixes that.

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

M	intern/cycles/kernel/kernel_shadow.h

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

diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h
index b3ae29932da..07043e6a769 100644
--- a/intern/cycles/kernel/kernel_shadow.h
+++ b/intern/cycles/kernel/kernel_shadow.h
@@ -431,8 +431,13 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
   if (state->transparent_bounce >= transparent_max_bounce) {
     return true;
   }
-  const uint max_hits = transparent_max_bounce - state->transparent_bounce - 1;
-#    if defined(__KERNEL_GPU__) && !defined(__KERNEL_OPTIX__)
+  uint max_hits = transparent_max_bounce - state->transparent_bounce - 1;
+#    if defined(__KERNEL_OPTIX__)
+  /* Always use record-all behavior in OptiX, but ensure there are no out of bounds
+   * accesses to the hit stack.
+   */
+  max_hits = min(max_hits, SHADOW_STACK_MAX_HITS - 1);
+#    elif defined(__KERNEL_GPU__)
   /* On GPU we do tricky with tracing opaque ray first, this avoids speed
    * regressions in some files.
    *



More information about the Bf-blender-cvs mailing list