forked from bartvdbraak/blender
Cycles: Solve possible buffer overrun when using too much closures
Glass BSDF was doing some magic with copying weigths from initial closure onto refraction one and the code was not checking properly for the number of closures.
This commit is contained in:
parent
1cbf748e0c
commit
d3e16df4f1
@ -285,15 +285,17 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
#endif
|
||||
|
||||
/* refraction */
|
||||
sc = ccl_fetch_array(sd, closure, ccl_fetch(sd, num_closure));
|
||||
sc->weight = weight;
|
||||
sc->sample_weight = sample_weight;
|
||||
if(ccl_fetch(sd, num_closure) < MAX_CLOSURE) {
|
||||
sc = ccl_fetch_array(sd, closure, ccl_fetch(sd, num_closure));
|
||||
sc->weight = weight;
|
||||
sc->sample_weight = sample_weight;
|
||||
|
||||
sc = svm_node_closure_get_bsdf(sd, mix_weight*(1.0f - fresnel));
|
||||
sc = svm_node_closure_get_bsdf(sd, mix_weight*(1.0f - fresnel));
|
||||
|
||||
if(sc) {
|
||||
sc->N = N;
|
||||
svm_node_glass_setup(sd, sc, type, eta, roughness, true);
|
||||
if(sc) {
|
||||
sc->N = N;
|
||||
svm_node_glass_setup(sd, sc, type, eta, roughness, true);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user