Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2020-01-10 17:42:44 +0300
committerPatrick Mours <pmours@nvidia.com>2020-01-10 17:47:51 +0300
commit1d149f6746a00cb49df202b1c49fcff4264dd226 (patch)
treeef648b1f04129cf2503a278b58fdae1137508e64
parent8e66183a982ab3e4c524af0d71d2f62ad4fd3c37 (diff)
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.
-rw-r--r--intern/cycles/kernel/kernel_shadow.h9
1 files changed, 7 insertions, 2 deletions
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.
*