From 0428951b9d554faae13807e033d40c2e0698dc7b Mon Sep 17 00:00:00 2001 From: Elie Tournier Date: Tue, 8 Aug 2017 13:39:18 +0100 Subject: [PATCH] glsl: Add "built-in" function to do abs(fp64) Signed-off-by: Elie Tournier --- src/compiler/glsl/float64.glsl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl index a299269677a..28e3258e0fb 100644 --- a/src/compiler/glsl/float64.glsl +++ b/src/compiler/glsl/float64.glsl @@ -56,3 +56,14 @@ #define FLOAT_ROUND_DOWN 2 #define FLOAT_ROUND_UP 3 #define FLOAT_ROUNDING_MODE FLOAT_ROUND_NEAREST_EVEN + +/* Absolute value of a Float64 : + * Clear the sign bit + */ +uint64_t +__fabs64(uint64_t __a) +{ + uvec2 a = unpackUint2x32(__a); + a.y &= 0x7FFFFFFFu; + return packUint2x32(a); +} -- 2.30.2