summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2018-11-08 22:12:16 -0800
committerMatt Turner <mattst88@gmail.com>2019-01-08 21:29:34 -0800
commit1d111a1fed2a4ef1ea14bf27a95dae61591d4af6 (patch)
tree8a23bcada65f2875380c4d1ebd7de407fcdb99cd
parent1bde8246ddf9d61fd1ff5587f1ffeba8b86f730c (diff)
glsl: Add "built-in" functions to convert bool to double
And vice versa. Reviewed-by: Elie Tournier <tournier.elie@gmail.com>
-rw-r--r--src/compiler/glsl/float64.glsl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index 7d12da50ac0..1808fec0727 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -951,6 +951,18 @@ __int_to_fp64(int a)
return __packFloat64(zSign, 0x412 - shiftCount, zFrac0, zFrac1);
}
+bool
+__fp64_to_bool(uint64_t a)
+{
+ return !__feq64_nonnan(__fabs64(a), 0ul);
+}
+
+uint64_t
+__bool_to_fp64(bool a)
+{
+ return __int_to_fp64(int(a));
+}
+
/* Packs the sign `zSign', exponent `zExp', and significand `zFrac' into a
* single-precision floating-point value, returning the result. After being
* shifted into the proper positions, the three fields are simply added