Merge branch 'blender-v2.90-release'

This commit is contained in:
Pablo Dobarro 2020-08-24 18:28:58 +02:00
commit 975fc39457
3 changed files with 12 additions and 3 deletions

@ -90,6 +90,7 @@ struct OSLTraceData {
ShaderData sd;
bool setup;
bool init;
bool hit;
};
/* thread key for thread specific data lookup */

@ -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);

@ -189,6 +189,12 @@ void multiresModifier_subdivide_to_level(struct Object *object,
}
Mesh *coarse_mesh = object->data;
if (coarse_mesh->totloop == 0) {
/* If there are no loops in the mesh inplies there is no CD_MDISPS as well. So can early output
* from here as there is nothing to subdivide. */
return;
}
MultiresReshapeContext reshape_context;
/* There was no multires at all, all displacement is at 0. Can simply make sure all mdisps grids