Fix T39577: cycles issue mixing anisotropic BSDFs with branched path tracer.
This commit is contained in:
@@ -453,23 +453,32 @@ ccl_device void shader_merge_closures(ShaderData *sd)
|
|||||||
ShaderClosure *scj = &sd->closure[j];
|
ShaderClosure *scj = &sd->closure[j];
|
||||||
|
|
||||||
#ifdef __OSL__
|
#ifdef __OSL__
|
||||||
if(!sci->prim && !scj->prim && sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1) {
|
if(sci->prim || scj->prim)
|
||||||
#else
|
continue;
|
||||||
if(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1) {
|
|
||||||
#endif
|
#endif
|
||||||
sci->weight += scj->weight;
|
|
||||||
sci->sample_weight += scj->sample_weight;
|
|
||||||
|
|
||||||
int size = sd->num_closure - (j+1);
|
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1))
|
||||||
if(size > 0) {
|
continue;
|
||||||
for(int k = 0; k < size; k++) {
|
|
||||||
scj[k] = scj[k+1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sd->num_closure--;
|
if(CLOSURE_IS_BSDF_OR_BSSRDF(sci->type)) {
|
||||||
j--;
|
if(sci->N != scj->N)
|
||||||
|
continue;
|
||||||
|
else if(CLOSURE_IS_BSDF_ANISOTROPIC(sci->type) && sci->T != scj->T)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sci->weight += scj->weight;
|
||||||
|
sci->sample_weight += scj->sample_weight;
|
||||||
|
|
||||||
|
int size = sd->num_closure - (j+1);
|
||||||
|
if(size > 0) {
|
||||||
|
for(int k = 0; k < size; k++) {
|
||||||
|
scj[k] = scj[k+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sd->num_closure--;
|
||||||
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -402,6 +402,8 @@ typedef enum ClosureType {
|
|||||||
#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_HAIR_REFLECTION_ID)
|
#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_HAIR_REFLECTION_ID)
|
||||||
#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID)
|
#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID)
|
||||||
#define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID)
|
#define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID)
|
||||||
|
#define CLOSURE_IS_BSDF_ANISOTROPIC(type) (type == CLOSURE_BSDF_WARD_ID)
|
||||||
|
#define CLOSURE_IS_BSDF_OR_BSSRDF(type) (type <= CLOSURE_BSSRDF_GAUSSIAN_ID)
|
||||||
#define CLOSURE_IS_BSSRDF(type) (type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_GAUSSIAN_ID)
|
#define CLOSURE_IS_BSSRDF(type) (type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_GAUSSIAN_ID)
|
||||||
#define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID)
|
#define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID)
|
||||||
#define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
|
#define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
|
||||||
|
Reference in New Issue
Block a user