From: Elie Tournier Date: Tue, 8 Aug 2017 12:39:18 +0000 (+0100) Subject: glsl: Add "built-in" function to do abs(fp64) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0428951b9d554faae13807e033d40c2e0698dc7b;p=mesa.git glsl: Add "built-in" function to do abs(fp64) Signed-off-by: Elie Tournier --- 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); +}