Fix Cycles CUDA transparent shadow error after recent fix in c22b52c.

Fishy cat benchmark was rendering with wrong shadows. Cause is unclear,
adding printf or rearranging code seems to avoid this issue, possibly a
compiler bug. This reverts the fix and solves the OSL bug elsewhere.
This commit is contained in:
Brecht Van Lommel
2017-08-24 03:33:33 +02:00
parent b85d36d811
commit 76b74a93a8
3 changed files with 12 additions and 11 deletions

View File

@@ -244,14 +244,14 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
{ {
/* shadow ray early termination */ /* shadow ray early termination */
#if defined(__KERNEL_SSE2__) #if defined(__KERNEL_SSE2__)
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) if(visibility & PATH_RAY_SHADOW_OPAQUE)
return true; return true;
tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t);
# if BVH_FEATURE(BVH_HAIR) # if BVH_FEATURE(BVH_HAIR)
tfar = ssef(isect->t); tfar = ssef(isect->t);
# endif # endif
#else #else
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) if(visibility & PATH_RAY_SHADOW_OPAQUE)
return true; return true;
#endif #endif
} }
@@ -274,14 +274,14 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
{ {
/* shadow ray early termination */ /* shadow ray early termination */
# if defined(__KERNEL_SSE2__) # if defined(__KERNEL_SSE2__)
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) if(visibility & PATH_RAY_SHADOW_OPAQUE)
return true; return true;
tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t);
# if BVH_FEATURE(BVH_HAIR) # if BVH_FEATURE(BVH_HAIR)
tfar = ssef(isect->t); tfar = ssef(isect->t);
# endif # endif
# else # else
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) if(visibility & PATH_RAY_SHADOW_OPAQUE)
return true; return true;
# endif # endif
} }
@@ -328,14 +328,14 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
if(hit) { if(hit) {
/* shadow ray early termination */ /* shadow ray early termination */
# if defined(__KERNEL_SSE2__) # if defined(__KERNEL_SSE2__)
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) if(visibility & PATH_RAY_SHADOW_OPAQUE)
return true; return true;
tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t);
# if BVH_FEATURE(BVH_HAIR) # if BVH_FEATURE(BVH_HAIR)
tfar = ssef(isect->t); tfar = ssef(isect->t);
# endif # endif
# else # else
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) if(visibility & PATH_RAY_SHADOW_OPAQUE)
return true; return true;
# endif # endif
} }

View File

@@ -340,7 +340,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
prim_addr)) { prim_addr)) {
tfar = ssef(isect->t); tfar = ssef(isect->t);
/* Shadow ray early termination. */ /* Shadow ray early termination. */
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) { if(visibility & PATH_RAY_SHADOW_OPAQUE) {
return true; return true;
} }
} }
@@ -362,7 +362,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
prim_addr)) { prim_addr)) {
tfar = ssef(isect->t); tfar = ssef(isect->t);
/* Shadow ray early termination. */ /* Shadow ray early termination. */
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) { if(visibility & PATH_RAY_SHADOW_OPAQUE) {
return true; return true;
} }
} }
@@ -409,7 +409,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
if(hit) { if(hit) {
tfar = ssef(isect->t); tfar = ssef(isect->t);
/* Shadow ray early termination. */ /* Shadow ray early termination. */
if(!(visibility & (PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE))) { if(visibility & PATH_RAY_SHADOW_OPAQUE) {
return true; return true;
} }
} }

View File

@@ -1197,8 +1197,9 @@ bool OSLRenderServices::trace(TraceOpt &options, OSL::ShaderGlobals *sg,
tracedata->init = true; tracedata->init = true;
tracedata->sd.osl_globals = sd->osl_globals; tracedata->sd.osl_globals = sd->osl_globals;
/* raytrace */ /* Raytrace, leaving out shadow opaque to avoid early exit. */
return scene_intersect(sd->osl_globals, ray, PATH_RAY_ALL_VISIBILITY, &tracedata->isect, NULL, 0.0f, 0.0f); uint visibility = PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE;
return scene_intersect(sd->osl_globals, ray, visibility, &tracedata->isect, NULL, 0.0f, 0.0f);
} }