[Piglit] [PATCH] builtin_functions.py: tweak integer constants

Brian Paul brianp at vmware.com
Fri Sep 13 13:00:30 PDT 2013


This fixes some misleading fs-op-div-* failures when the driver does
integer arithmetic with floating point.  When we compute the reciprocal
of some integers we wind up with inexact floating point results.  So
expressions like X/X result in 0.9999 or such.

This patch tweaks the generator code to use some "nicer" integers
so that X/X comes out as expected.

Note the GLSL 1.10 spec, section 4.1.3:
"However, there is no requirement that integers in the language map to
an integer type in hardware. It is not expected that underlying hardware
has full support for a wide range of integer operations."
---
 generated_tests/builtin_function.py |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
index 3008893..e1f43a4 100644
--- a/generated_tests/builtin_function.py
+++ b/generated_tests/builtin_function.py
@@ -1017,7 +1017,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
     bvecs = [np.array(bs) for bs in itertools.product(bools, bools)] + \
         [np.array(bs) for bs in itertools.product(bools, bools, bools)] + \
         [np.array(bs) for bs in itertools.product(bools, bools, bools, bools)]
-    ints = [np.int32(x) for x in [12, -6, 74, -32, 0]]
+    ints = [np.int32(x) for x in [12, -6, 76, -32, 0]]
     small_ints = \
         [np.int32(x) for x in [-31, -25, -5, -2, -1, 0, 1, 2, 5, 25, 31]]
     ivecs = [
@@ -1027,10 +1027,10 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
         np.array([-36, 32, -88], dtype=np.int32),
         np.array([36, 32, 88], dtype=np.int32),
         np.array([59, 77, 68], dtype=np.int32),
-        np.array([-66, 72, 87, -75], dtype=np.int32),
-        np.array([66, 72, 87, 75], dtype=np.int32),
-        np.array([-24, 40, -23, 74], dtype=np.int32),
-        np.array([24, 40, 23, 74], dtype=np.int32),
+        np.array([-64, 72, 88, -76], dtype=np.int32),
+        np.array([64, 72, 88, 76], dtype=np.int32),
+        np.array([-24, 40, -23, 64], dtype=np.int32),
+        np.array([24, 40, 23, 64], dtype=np.int32),
         ]
     small_ivecs = [
         np.array([13, 26], dtype=np.int32),
-- 
1.7.10.4



More information about the Piglit mailing list