diff options
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 9196caad1b3..316d24b0954 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -1392,9 +1392,16 @@ bool OSLRenderServices::trace(TraceOpt &options, tracedata->init = true; tracedata->sd.osl_globals = sd->osl_globals; + KernelGlobals *kg = sd->osl_globals; + + /* Can't raytrace from shaders like displacement, before BVH exists. */ + if (kernel_data.bvh.bvh_layout == BVH_LAYOUT_NONE) { + return false; + } + /* Raytrace, leaving out shadow opaque to avoid early exit. */ uint visibility = PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE; - return scene_intersect(sd->osl_globals, ray, visibility, &tracedata->isect); + return scene_intersect(kg, ray, visibility, &tracedata->isect); } bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, |