summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2018-11-08 21:34:05 -0800
committerMatt Turner <[email protected]>2019-01-09 16:42:40 -0800
commit83762afa664bd491aa7e3009a598ffa10e52b386 (patch)
tree21e3c671e38c19dfe734a8adce350ecd9a0f8d77
parent92ac2169fb015b7bb0b8e5fc2c99131e3c652cbb (diff)
glsl: Add "built-in" functions to do fmin/fmax(fp64)
Reviewed-by: Elie Tournier <[email protected]>
-rw-r--r--src/compiler/glsl/float64.glsl20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index 1a434b1fd59..88ce0a74957 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -1425,3 +1425,23 @@ __fround64(uint64_t __a)
a.y = aHi;
return packUint2x32(a);
}
+
+uint64_t
+__fmin64(uint64_t a, uint64_t b)
+{
+ if (__is_nan(a)) return b;
+ if (__is_nan(b)) return a;
+
+ if (__flt64_nonnan(a, b)) return a;
+ return b;
+}
+
+uint64_t
+__fmax64(uint64_t a, uint64_t b)
+{
+ if (__is_nan(a)) return b;
+ if (__is_nan(b)) return a;
+
+ if (__flt64_nonnan(a, b)) return b;
+ return a;
+}