[regression][bisected] KHR-GL46.gpu_shader_fp64.builtin.mod_dvec{2,3,4} failures
The following tests fail on all HSW, BDW, gen9, ICL, and TGL GPUs, i965 and Iris: KHR-GL46.gpu_shader_fp64.builtin.mod_dvec2 KHR-GL46.gpu_shader_fp64.builtin.mod_dvec3 KHR-GL46.gpu_shader_fp64.builtin.mod_dvec4
test output:
Error. Invalid result.
Function: mod
Result (dvec2) [0, -13.375]
Expected result (dvec2) [0, 0]
Argument (dvec2) [-13.5, -13.375]
Argument (dvec2) [-13.5, -13.375]
Shader:
#version 400 core
precision highp float;
uniform dvec2 uniform_0;
uniform dvec2 uniform_1;
flat out dvec2 result_0;
void main()
{
result_0 = dvec2(mod(uniform_0, uniform_1));
}
Bisected to:
commit acd0dd3b4b223a423fbe9ffd118c3fbbf119d993
Author: Juan A. Suarez Romero <jasuarez@igalia.com>
Date: Tue Mar 10 10:49:42 2020 +0000
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].
For the OpenGL case, while the spec does not allow this behaviour, due
the allowed precision errors we can end up having the same result, so
from a practical point of view, this behaviour is allowed (see
https://github.com/KhronosGroup/VK-GL-CTS/issues/51).
This commit takes this in account to remove the extra instruction
required to return 0 instead.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4118>