Skip to content

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.

Merge request reports