From c802cdde9df1295fe0d6d6a3dbf4151f46070d19 Mon Sep 17 00:00:00 2001 From: Elie Tournier Date: Tue, 8 Aug 2017 14:12:35 +0100 Subject: [PATCH] glsl: Add "built-in" function to do sign(fp64) v2: use mix. Signed-off-by: Elie Tournier --- src/compiler/glsl/float64.glsl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl index 5f873319b42..31aae3fca22 100644 --- a/src/compiler/glsl/float64.glsl +++ b/src/compiler/glsl/float64.glsl @@ -93,3 +93,13 @@ __fneg64(uint64_t __a) a.y = mix(t, a.y, __is_nan(__a)); return packUint2x32(a); } + +uint64_t +__fsign64(uint64_t __a) +{ + uvec2 a = unpackUint2x32(__a); + uvec2 retval; + retval.x = 0u; + retval.y = mix((a.y & 0x80000000u) | 0x3FF00000u, 0u, (a.y << 1 | a.x) == 0u); + return packUint2x32(retval); +} -- 2.30.2