Fix T43596: Refraction BSDF crashes blender on pre-sse4 CPU
This is the same issue T43475: SSE4 code is more robust to non-finite values in the ray origin/direction. So for now added a check before doing BVH traversal for pre-SSE4 CPUs. For sure actual root of the issue is a bit different and much more tricky to solve, especially without disturbing render results too much. Still looking into this. In any case, it's kinda fine to have such a check, we might later make it to be a kernel_assert() instead of just a return.
This commit is contained in:
@@ -58,6 +58,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
||||
Transform ob_tfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
if(!isfinite(P.x)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
int num_hits_in_instance = 0;
|
||||
#endif
|
||||
|
@@ -61,6 +61,12 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
||||
Transform ob_tfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
if(!isfinite(P.x)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
ssef tnear(0.0f), tfar(isect_t);
|
||||
sse3f idir4(ssef(idir.x), ssef(idir.y), ssef(idir.z));
|
||||
|
||||
|
@@ -66,6 +66,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
||||
Transform ob_tfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
if(!isfinite(P.x)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
isect->t = ray->t;
|
||||
isect->u = 0.0f;
|
||||
isect->v = 0.0f;
|
||||
|
@@ -57,6 +57,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
||||
Transform ob_tfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
if(!isfinite(P.x)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
isect->t = ray->t;
|
||||
isect->u = 0.0f;
|
||||
isect->v = 0.0f;
|
||||
|
@@ -314,9 +314,6 @@ ccl_device_inline float3 triangle_refine(KernelGlobals *kg,
|
||||
|
||||
#ifdef __INTERSECTION_REFINE__
|
||||
if(isect->object != OBJECT_NONE) {
|
||||
if(UNLIKELY(t == 0.0f)) {
|
||||
return P;
|
||||
}
|
||||
#ifdef __OBJECT_MOTION__
|
||||
Transform tfm = sd->ob_itfm;
|
||||
#else
|
||||
|
Reference in New Issue
Block a user