From 83762afa664bd491aa7e3009a598ffa10e52b386 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 8 Nov 2018 21:34:05 -0800 Subject: [PATCH] glsl: Add "built-in" functions to do fmin/fmax(fp64) Reviewed-by: Elie Tournier --- src/compiler/glsl/float64.glsl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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; +} -- 2.30.2