[Piglit] [PATCH] fbo-blending-formats: fix expected result for intensity and luminance textures

Brian Paul brianp at vmware.com
Mon Mar 12 16:22:49 PDT 2012


This is pretty much the same fix as for the fbo-alphatest-formats test.
Note: NVIDIA's driver is still failing for GL_RGB5_A1 for some unknown reason.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=47217
---
 tests/fbo/fbo-blending-formats.c |   48 ++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
index 5ea1b05..b696655 100644
--- a/tests/fbo/fbo-blending-formats.c
+++ b/tests/fbo/fbo-blending-formats.c
@@ -136,20 +136,23 @@ static enum piglit_result test_format(const struct format_desc *format, GLenum b
 	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
 				 GL_TEXTURE_BLUE_SIZE, &b);
 
+	/* Compute expected result colors when reading back from a texture/FBO */
         if (i) {
-		res0[3] = res0[2] = res0[1] = res0[0];
-		res1[3] = res1[2] = res1[1] = res1[0];
-		res2[3] = res2[2] = res2[1] = res2[0];
-		res3[3] = res3[2] = res3[1] = res3[0];
-		res4[3] = res4[2] = res4[1] = res4[0] = res4i;
-		res5[3] = res5[2] = res5[1] = res5[0];
+		/* expected result = (I, 0, 0, 1) */
+		res0[1] = res0[2] = 0.0;   res0[3] = 1.0;
+		res1[1] = res1[2] = 0.0;   res1[3] = 1.0;
+		res2[1] = res2[2] = 0.0;   res2[3] = 1.0;
+		res3[1] = res3[2] = 0.0;   res3[3] = 1.0;
+		res4[1] = res4[2] = 0.0;   res4[3] = 1.0;   res4[0] = res4i;
+		res5[1] = res5[2] = 0.0;   res5[3] = 1.0;
 	} else if (l) {
-		res0[2] = res0[1] = res0[0];
-		res1[2] = res1[1] = res1[0];
-		res2[2] = res2[1] = res2[0];
-		res3[2] = res3[1] = res3[0];
-		res4[2] = res4[1] = res4[0];
-		res5[2] = res5[1] = res5[0];
+		/* expected result = (L, 0, 0, A) */
+		res0[1] = res0[2] = 0.0;
+		res1[1] = res1[2] = 0.0;
+		res2[1] = res2[2] = 0.0;
+		res3[1] = res3[2] = 0.0;
+		res4[1] = res4[2] = 0.0;
+		res5[1] = res5[2] = 0.0;
 		if (!a) {
 			res0[3] = 1;
 			res1[3] = 1;
@@ -297,6 +300,27 @@ static enum piglit_result test_format(const struct format_desc *format, GLenum b
 		return PIGLIT_FAIL;
 	}
 
+	/* Compute expected result colors when reading back from the window */
+        if (i) {
+		/* result = (I,I,I,I) */
+		res0[3] = res0[2] = res0[1] = res0[0];
+		res1[3] = res1[2] = res1[1] = res1[0];
+		res2[3] = res2[2] = res2[1] = res2[0];
+		res3[3] = res3[2] = res3[1] = res3[0];
+		res4[3] = res4[2] = res4[1] = res4[0] = res4i;
+		res5[3] = res5[2] = res5[1] = res5[0];
+	} else if (l) {
+		/* result = (L,L,L,A) */
+		res0[2] = res0[1] = res0[0];
+		res1[2] = res1[1] = res1[0];
+		res2[2] = res2[1] = res2[0];
+		res3[2] = res3[1] = res3[0];
+		res4[2] = res4[1] = res4[0];
+		res5[2] = res5[1] = res5[0];
+	} else {
+		/* leave 'res' colors as-is from above */
+	}
+
 	if (!piglit_probe_pixel_rgba(piglit_width * 1 / 12, 0, res0)) {
 		printf("  when testing window result, simple.\n");
 		pass = GL_FALSE;
-- 
1.7.3.4



More information about the Piglit mailing list