glsl: Add "built-in" function to do abs(fp64)
authorElie Tournier <tournier.elie@gmail.com>
Tue, 8 Aug 2017 12:39:18 +0000 (13:39 +0100)
committerMatt Turner <mattst88@gmail.com>
Thu, 10 Jan 2019 00:42:40 +0000 (16:42 -0800)
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
src/compiler/glsl/float64.glsl

index a299269677a6b154a8694aabda0c83eae9ed5bc8..28e3258e0fb6696f83eb0a3395d38c61d1773b2a 100644 (file)
 #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);
+}