diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-24 19:28:58 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-24 19:28:58 +0300 |
commit | 975fc39457f19c88a1764f3298ea0bc245c8a343 (patch) | |
tree | 2f43c09e7f60b081e1ff1207224b800eafb9972a /intern/cycles/kernel | |
parent | 8e18a9984505514a229d66b38fff31d930367968 (diff) | |
parent | 1bced5884c3dd80c74dfdcf621eae3b90d32a662 (diff) |
Merge branch 'blender-v2.90-release'
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/osl/osl_globals.h | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/intern/cycles/kernel/osl/osl_globals.h b/intern/cycles/kernel/osl/osl_globals.h index c06c9abd4c1..caca3c28c8d 100644 --- a/intern/cycles/kernel/osl/osl_globals.h +++ b/intern/cycles/kernel/osl/osl_globals.h @@ -90,6 +90,7 @@ struct OSLTraceData { ShaderData sd; bool setup; bool init; + bool hit; }; /* thread key for thread specific data lookup */ diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 5292b5f8055..aee1e3a244e 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -1481,6 +1481,7 @@ bool OSLRenderServices::trace(TraceOpt &options, tracedata->ray = ray; tracedata->setup = false; tracedata->init = true; + tracedata->hit = false; tracedata->sd.osl_globals = sd->osl_globals; KernelGlobals *kg = sd->osl_globals; @@ -1492,7 +1493,8 @@ bool OSLRenderServices::trace(TraceOpt &options, /* Raytrace, leaving out shadow opaque to avoid early exit. */ uint visibility = PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE; - return scene_intersect(kg, &ray, visibility, &tracedata->isect); + tracedata->hit = scene_intersect(kg, &ray, visibility, &tracedata->isect); + return tracedata->hit; } bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, @@ -1506,9 +1508,9 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, if (source == u_trace && tracedata->init) { if (name == u_hit) { - return set_attribute_int((tracedata->isect.prim != PRIM_NONE), type, derivatives, val); + return set_attribute_int(tracedata->hit, type, derivatives, val); } - else if (tracedata->isect.prim != PRIM_NONE) { + else if (tracedata->hit) { if (name == u_hitdist) { float f[3] = {tracedata->isect.t, 0.0f, 0.0f}; return set_attribute_float(f, type, derivatives, val); |