summaryrefslogtreecommitdiff
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorElie Tournier <tournier.elie@gmail.com>2017-08-08 14:12:35 +0100
committerMatt Turner <mattst88@gmail.com>2019-01-09 16:42:40 -0800
commitc802cdde9df1295fe0d6d6a3dbf4151f46070d19 (patch)
treeeba40037d57b9d4deaf1cd6c345286f1692e8af3 /src/compiler/glsl
parenteac66f024865640a328803b024d9bf025c408e49 (diff)
downloadmesa-c802cdde9df1295fe0d6d6a3dbf4151f46070d19.tar.gz
mesa-c802cdde9df1295fe0d6d6a3dbf4151f46070d19.tar.bz2
mesa-c802cdde9df1295fe0d6d6a3dbf4151f46070d19.zip
glsl: Add "built-in" function to do sign(fp64)
v2: use mix. Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/float64.glsl10
1 files changed, 10 insertions, 0 deletions
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);
+}