nir/lower_double_ops: relax lower mod()
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Thu, 28 Nov 2019 16:58:45 +0000 (16:58 +0000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 19 Dec 2019 12:36:30 +0000 (12:36 +0000)
commit8172b1fa03fe74165728bfb182c98a3e62193d2b
tree3e896db8fcd022ae39aac95e12a5862134515567
parentaf65bfb38fa56bf6a28dd4b681ca123b9c05a827
nir/lower_double_ops: relax lower mod()

Currently when lowering mod() we add an extra instruction so if
mod(a,b) == b then 0 is returned instead of b, as mathematically
mod(a,b) is in the interval [0, b).

But Vulkan spec has relaxed this restriction, and allows the result to
be in the interval [0, b].

This commit takes this in account to remove the extra instruction
required to return 0 instead.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2922>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2922>
src/compiler/nir/nir_lower_double_ops.c