[Piglit] [PATCH 3/3] fbo-blending-formats: Fix expected color values for DST_ALPHA blending
Carl Worth
cworth at cworth.org
Mon Jan 14 14:30:29 PST 2013
In the case where there are 0 bits of destination alpha, we need to
compute different expected results for the color when rendering with
DST_ALPHA. The results are initialized with calculations that blend
src and destination color such as:
res4[X] = dst4[X]*(1-dst4[ALPHA]) + src4[X]*dst4[ALPHA]
But when there is no destination alpha channel, instead of the blend
factor dst4[ALPHA] in the above, the result should be computed with
this value replaced with 1.0. In other words, the correct calculation
for the expected result color becomes:
res4[X] = src4[X]
---
tests/fbo/fbo-blending-formats.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
index e8528e9..d238966 100644
--- a/tests/fbo/fbo-blending-formats.c
+++ b/tests/fbo/fbo-blending-formats.c
@@ -217,12 +217,24 @@ static enum piglit_result test_format(const struct format_desc *format)
res5[2] = 0;
}
if (!a) {
+ /* When there are no bits for the alpha channel, we
+ * always expect to read an alpha value of 1.0.
+ */
res0[3] = 1;
res1[3] = 1;
res2[3] = 1;
res3[3] = 1;
res4[3] = 1;
res5[3] = 1;
+
+ /* Also blending with DST_ALPHA/ONE_MINUS_DST_ALPHA
+ * (as in case 4) with an implicit destination alpha
+ * value of 1.0 means that the result color should be
+ * identical to the source color.
+ */
+ res4[0] = src4[0];
+ res4[1] = src4[1];
+ res4[2] = src4[2];
}
}
--
1.7.10.4
More information about the Piglit
mailing list