Cycles: Fix issue in closure merge function.

* Did not check data2, this partially fixes T45583.
* Initialize data2 in some closures to avoid potential problems.

Differential Revision: https://developer.blender.org/D1436
This commit is contained in:
Lukas Stockner 2015-07-29 22:04:36 +02:00 committed by Thomas Dinges
parent d49703b298
commit 4737b12462
2 changed files with 4 additions and 1 deletions

@ -459,7 +459,7 @@ ccl_device void shader_merge_closures(ShaderData *sd)
continue;
#endif
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1))
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1 && sci->data2 == scj->data2))
continue;
if(CLOSURE_IS_BSDF_OR_BSSRDF(sci->type)) {

@ -30,6 +30,7 @@ ccl_device void svm_node_glass_setup(ShaderData *sd, ShaderClosure *sc, int type
else {
sc->data0 = 0.0f;
sc->data1 = 0.0f;
sc->data2 = 0.0f;
ccl_fetch(sd, flag) |= bsdf_reflection_setup(sc);
}
}
@ -393,6 +394,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
sc->N = N;
sc->data0 = 0.0f;
sc->data1 = 0.0f;
sc->data2 = 0.0f;
ccl_fetch(sd, flag) |= bsdf_transparent_setup(sc);
}
}
@ -545,6 +547,7 @@ ccl_device void svm_node_closure_volume(KernelGlobals *kg, ShaderData *sd, float
if(sc) {
sc->data0 = param2; /* g */
sc->data1 = 0.0f;
sc->data2 = 0.0f;
ccl_fetch(sd, flag) |= volume_henyey_greenstein_setup(sc);
}
break;