[Piglit] [PATCH 2/5] read-front: modify the test to reproduce an MSAA front buffer bug in st/dri

Marek Olšák maraeo at gmail.com
Tue Jun 4 16:54:53 PDT 2013


v2: move the clearing code to piglit_display
---
 tests/all.tests            |    1 +
 tests/general/read-front.c |   21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/all.tests b/tests/all.tests
index 417ca08..058253d 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -526,6 +526,7 @@ add_concurrent_test(gl11, 'polygon-mode-offset')
 add_concurrent_test(gl11, 'push-pop-texture-state')
 add_concurrent_test(gl11, 'quad-invariance')
 add_plain_test(gl11, 'read-front')
+add_plain_test(gl11, 'read-front clear-front-first')
 add_concurrent_test(gl11, 'readpix-z')
 add_plain_test(gl11, 'roundmode-getintegerv')
 add_plain_test(gl11, 'roundmode-pixelstore')
diff --git a/tests/general/read-front.c b/tests/general/read-front.c
index e6833dc..5208d04 100644
--- a/tests/general/read-front.c
+++ b/tests/general/read-front.c
@@ -46,6 +46,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+static GLboolean clear_front_first;
+
 enum piglit_result
 piglit_display(void)
 {
@@ -55,7 +57,15 @@ piglit_display(void)
 
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glClearColor(0.0, 0.0, 1.0, 0.0);
+	if (clear_front_first) {
+		/* This should allocate the front buffer in the driver
+		 * if it hasn't been allocated already.
+		 */
+		glDrawBuffer(GL_FRONT);
+		glClear(GL_COLOR_BUFFER_BIT);
+		glDrawBuffer(GL_BACK);
+	}
+
 	glClear(GL_COLOR_BUFFER_BIT);
 	glColor4fv(green);
 	piglit_draw_rect(0, piglit_height / 2, piglit_width, piglit_height);
@@ -78,4 +88,13 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
+	int i;
+
+	glClearColor(0.0, 0.0, 1.0, 0.0);
+
+	for (i = 1; i < argc; i++) {
+		if (strcmp(argv[i], "clear-front-first") == 0) {
+			clear_front_first = GL_TRUE;
+		}
+	}
 }
-- 
1.7.10.4



More information about the Piglit mailing list