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.
This commit is contained in:
Patrick Mours 2020-01-10 15:42:44 +01:00
parent 8e66183a98
commit 1d149f6746
Notes: blender-bot 2023-02-14 06:00:44 +01:00
Referenced by issue #72470, OptiX render fails with scene with many translucent planes on Linux.
1 changed files with 7 additions and 2 deletions

View File

@ -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.
*