Fix Cycles Embree crash with AO shader local only option
Ref T73778
This commit is contained in:
parent
1761d65b25
commit
ca72ff599a
Notes:
blender-bot
2023-02-13 23:30:47 +01:00
Referenced by issue #77106, Crash when baking diffuse map. (EXCEPTION_ACCESS_VIOLATION) Referenced by issue #73778, Cycles: Embree improvements
|
@ -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__ */
|
||||
|
||||
|
|
Loading…
Reference in New Issue