Skip to content

shaders/sampling: guard against floating point inaccuracy

Niklas Haas requested to merge polar_inaccuracy into master

This code suffered from a pathological edge case (rounding up vs rounding down), triggered by floating point inaccuracy, almost exactly aligning with the incredibly common case of integer scaling ratios.

Bias the ceil() function ever-so-slightly down. A margin of 1e-5 is more than enough to avoid floating point inaccuracy, while being small enough to avoid this causing any actual issues (unless upscaling by a factor of a million or more, at which point you have much bigger concerns).

Fixes #207 (closed)

Merge request reports