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