We were returning 3*pi/4 when we should return 0.0 according to IEEE 754. Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> --- src/compiler/spirv/vtn_glsl450.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index 64a1431ae14..ab4eb7da1e3 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -402,8 +402,12 @@ build_atan2(nir_builder *b, nir_ssa_def *y, nir_ssa_def *x) * continuous along the whole positive y = 0 half-line, so it won't affect * the result significantly. */ - return nir_bcsel(b, nir_flt(b, nir_fmin(b, y, rcp_scaled_t), zero), - nir_fneg(b, arc), arc); + nir_ssa_def *result = nir_bcsel(b, nir_flt(b, nir_fmin(b, y, rcp_scaled_t), zero), + nir_fneg(b, arc), arc); + nir_ssa_def *is_xy_zero = nir_iand(b, + nir_feq(b, x, zero), + nir_feq(b, y, zero)); + return nir_bcsel(b, is_xy_zero, zero, result); } static nir_ssa_def * -- 2.19.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev