[Piglit] [PATCH 1/3] fbo-blending-formats: Enable testing for channels with 0 bits of data.

Carl Worth cworth at cworth.org
Mon Jan 14 14:30:27 PST 2013


The existing code is intentionally disabling testing for channels with
1 bit of data, (since the ambiguity in rounding makes it infeasible to
test). But the disabling of testing for 0-bit channels was
unintentional collateral damage.

In particular, for RGB-only formats it's important to test that
results always provide a value of 1.0 for alpha.

So we change the condition to disable tests only when the number of
bits is equal to 1, (as opposed to less then 2). We also just fudge in
a tolerance value corresponding to 8 bits for channels with 0 bits of
storage. (The tolerance probably doesn't matter at all here since we
should really only be doing exact comparisons of values of 0.0 or
1.0).
---
 tests/util/piglit-util-gl-common.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index 7674d4e..25098b8 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -297,9 +297,15 @@ piglit_set_tolerance_for_bits(int rbits, int gbits, int bbits, int abits)
 	int i;
 
 	for (i = 0; i < 4; i++) {
-		if (bits[i] < 2) {
+		if (bits[i] == 0) {
+			/* With 0 bits of storage, we still want to
+			 * validate expected results, (such as
+			 * alpha==1.0 when targeting storage with no
+			 * alpha bits). */
+			piglit_tolerance[i] = 3.0 / (1 << 8);
+		} else if (bits[i] == 1) {
 			/* Don't try to validate channels when there's only 1
-			 * bit of precision (or none).
+			 * bit of precision.
 			 */
 			piglit_tolerance[i] = 1.0;
 		} else {
-- 
1.7.10.4



More information about the Piglit mailing list