diff options
author | Elie Tournier <[email protected]> | 2017-08-08 13:39:18 +0100 |
---|---|---|
committer | Matt Turner <[email protected]> | 2019-01-09 16:42:40 -0800 |
commit | 0428951b9d554faae13807e033d40c2e0698dc7b (patch) | |
tree | 1af44b3e009160d0e5a0f5ac4d5ff17e23e87a46 /src/compiler/glsl | |
parent | b63a1f8e40b6705d6a1d806fbd38dcd197d4229b (diff) |
glsl: Add "built-in" function to do abs(fp64)
Signed-off-by: Elie Tournier <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/float64.glsl | 11 |
1 files changed, 11 insertions, 0 deletions
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); +} |