Fix #30049: cycles noise texture producing nan values with some

texture coordinates, due to int overflow.

Also minor tweak in shader code to avoid copying uninitialized
values, should have no effect though because they were not used.
This commit is contained in:
Brecht Van Lommel 2012-02-07 17:32:01 +00:00
parent b67b1c8564
commit 4a427a441b
2 changed files with 9 additions and 7 deletions

@ -368,13 +368,14 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd,
#else
label = svm_bsdf_sample(sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
#endif
if(*pdf != 0.0f) {
bsdf_eval_init(bsdf_eval, sc->type, eval*sc->weight, kernel_data.film.use_light_pass);
if(sd->num_closure > 1 && *pdf != 0.0f) {
if(sd->num_closure > 1) {
float sweight = sc->sample_weight;
_shader_bsdf_multi_eval(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
}
}
return label;
#else

@ -84,8 +84,9 @@ __device uint phash(int kx, int ky, int kz, int3 p)
__device float floorfrac(float x, int* i)
{
*i = quick_floor(x);
return x - *i;
float f = floorf(x);
*i = (int)f;
return x - f;
}
__device float fade(float t)