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:
authorBrecht Van Lommel <brecht@blender.org>2020-02-18 02:20:58 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-02-18 02:45:30 +0300
commitca72ff599a96b64e6159e8e8f891f9649c0717a3 (patch)
tree50a2c53f3761cbbe667920bcd3c7c19bd8fe6bf4 /intern/cycles/kernel
parent1761d65b25d7161e8597bae9fa0ae7b0cf93c17f (diff)
Fix Cycles Embree crash with AO shader local only option
Ref T73778
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/bvh/bvh.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h
index 75081085af5..b3992c03a9a 100644
--- a/intern/cycles/kernel/bvh/bvh.h
+++ b/intern/cycles/kernel/bvh/bvh.h
@@ -336,7 +336,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg,
ctx.lcg_state = lcg_state;
ctx.max_hits = max_hits;
ctx.local_isect = local_isect;
- local_isect->num_hits = 0;
+ if (local_isect) {
+ local_isect->num_hits = 0;
+ }
ctx.local_object_id = local_object;
IntersectContext rtc_ctx(&ctx);
RTCRay rtc_ray;
@@ -373,7 +375,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg,
rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray);
}
- return local_isect->num_hits > 0;
+ /* rtcOccluded1 sets tfar to -inf if a hit was found. */
+ return (local_isect && local_isect->num_hits > 0) || (rtc_ray.tfar < 0);
+ ;
}
# endif /* __EMBREE__ */