Page MenuHome

Avoid division by zero when viewport AA samples are zero

Authored by Robert Guetzkow (rjg) on Thu, Mar 26, 2:47 PM.



This patch fixes T75087 by setting float offset to zero if wpd->taa_sample_len is zero. The offset is only used as input to get_random_vector(), which also works fine with a zero offset.

Diff Detail

rB Blender
2020-03-25-fix-divide-by-zero (branched from master)
Build Status
Buildable 7306
Build 7306: arc lint + arc unit

Event Timeline

This comment was removed by Robert Guetzkow (rjg).
Clément Foucault (fclem) requested changes to this revision.Thu, Mar 26, 2:59 PM
Clément Foucault (fclem) added inline comments.

Prefer offset = wpd->taa_sample / (float)max_ii(1, wpd->taa_sample_len);.

I also just found that we are missing a float cast here.

This revision now requires changes to proceed.Thu, Mar 26, 2:59 PM

This revision was abandoned because I don't have commit access yet and this one line fix is easier and faster to add if @Clément Foucault (fclem) does this himself. The fix was commited in rBa0437c3f730f14be83f8e6cb20432b3775ffd03f.