[Piglit] [PATCH] ARB_shading_language_packing: fix exact tests

Paul Berry stereotype441 at gmail.com
Tue Feb 19 08:44:18 PST 2013


Commit 78435fe (ARB_shading_language_packing: Allow some imprecision
in unpackUnorm4x8) inadvertently introduced a regression to the
unpackHalf2x16 tests.  In those tests, the "exact" uniform wasn't
being initialized, resulting in the tests being run in inexact
fashion.

Surprisingly, this actually produced a failure, because inexact
testing uses "distance(actual, expect) < 0.00001" as the pass/fail
criterion, and this doesn't work when actual == expect == Infinity
(because distance(Inf, Inf) == NaN).

We always intended to test unpackHalf2x16 in exact fashion anyhow, so
the fix is to go ahead and initialize the "exact" uniform to 1 for
this case.
---
 generated_tests/gen_builtin_packing_tests.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_builtin_packing_tests.py b/generated_tests/gen_builtin_packing_tests.py
index 706ba1f..5eeea62 100644
--- a/generated_tests/gen_builtin_packing_tests.py
+++ b/generated_tests/gen_builtin_packing_tests.py
@@ -277,7 +277,9 @@ vs_unpack_template = Template(dedent("""\
     [test]
     % for io in func.inout_seq:
     uniform uint func_input ${io.input}
-    % if not func.exact:
+    % if func.exact:
+    uniform int exact 1
+    % else:
     uniform int exact ${int(int(io.input[:-1]) in (0x0, 0xffffffff, 0x80808080, 0x81818181))}
     % endif
     % for j in range(func.num_valid_outputs):
@@ -410,7 +412,9 @@ fs_unpack_template = Template(dedent("""\
     [test]
     % for io in func.inout_seq:
     uniform uint func_input ${io.input}
-    % if not func.exact:
+    % if func.exact:
+    uniform int exact 1
+    % else:
     uniform int exact ${int(int(io.input[:-1]) in (0x0, 0xffffffff, 0x80808080, 0x81818181))}
     % endif
     % for i in range(func.num_valid_outputs):
-- 
1.8.1.3



More information about the Piglit mailing list