summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2018-11-08 21:59:42 -0800
committerMatt Turner <[email protected]>2019-01-09 16:42:40 -0800
commit5c9a659f50d40bc7de291ed38cb1d6c76c15e731 (patch)
treed230880a38f7773f293e8281daf0216ebb930aa3
parent83762afa664bd491aa7e3009a598ffa10e52b386 (diff)
glsl: Add "built-in" function to do ffloor(fp64)
Reviewed-by: Elie Tournier <[email protected]>
-rw-r--r--src/compiler/glsl/float64.glsl13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index 88ce0a74957..c54835fbf78 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -1385,6 +1385,19 @@ __ftrunc64(uint64_t __a)
}
uint64_t
+__ffloor64(uint64_t a)
+{
+ bool is_positive = __fge64(a, 0ul);
+ uint64_t tr = __ftrunc64(a);
+
+ if (is_positive || __feq64(tr, a)) {
+ return tr;
+ } else {
+ return __fadd64(tr, 0xbff0000000000000ul /* -1.0 */);
+ }
+}
+
+uint64_t
__fround64(uint64_t __a)
{
uvec2 a = unpackUint2x32(__a);