[Piglit] [PATCH] glsl/frexp: fix the incorrect expected values

asimiklit.work at gmail.com asimiklit.work at gmail.com
Wed Oct 24 12:52:08 UTC 2018


From: Andrii Simiklit <andrii.simiklit at globallogic.com>

I guess that this test has the incorrect expected values.
For instance the test expects that exponent for a value 2 will be 1
But it contradicts to spec because in this case
the value of 'significand' must be 1.0:
2.0 = 1.0 * 2 ^ 1

GLSL spec says (about 'frexp'):
  "Splits x into a floating-point significand in the range
   [0.5, 1.0) and an integral exponent of two, such that:

      x = significand * 2 ^ exponent

   The significand is returned by the function and the
   exponent is returned in the parameter exp. For a
   floating-point value of zero, the significant and exponent
   are both zero. For a floating-point value that is an
   infinity or is not a number, the results are undefined.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108537
Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
---
 .../fs-frexp-dvec4-only-exponent.shader_test        | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
index d7dc64032..c4a7555ff 100644
--- a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test
@@ -31,7 +31,18 @@ clear color 0 0 0 1
 clear
 
 uniform dvec4 u_in 2 3 4 9
-uniform ivec4 u_exponent 1 1 2 3
+
+# The function frexp() splits each single-precision floating-point number in
+# <x> into a binary significand, a floating-point number in the range [0.5,
+# 1.0), and an integral exponent of two, such that:
+#
+#    x = significand * 2 ^ exponent
+#
+# 2 = 0.5 * 2^2
+# 3 = 0.75 * 2^2
+# 4 = 0.5 * 2^3
+# 9 = 0.5625 * 2^4
+uniform ivec4 u_exponent 2 2 3 4
 
 draw rect -1 -1 2 2
 probe all rgba 0 1 0 1
-- 
2.17.1



More information about the Piglit mailing list