[Piglit] [PATCH 3/3] fbo-drawbuffers2-color: test masked clear

Marek Olšák maraeo at gmail.com
Mon Jan 14 11:18:01 PST 2013


---
 tests/all.tests                        |    1 +
 tests/fbo/fbo-drawbuffers2-colormask.c |   19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/tests/all.tests b/tests/all.tests
index f719f7c..514b1cb 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2110,6 +2110,7 @@ ext_draw_buffers2 = Group()
 spec['EXT_draw_buffers2'] = ext_draw_buffers2
 add_plain_test(ext_draw_buffers2, 'fbo-drawbuffers2-blend')
 add_plain_test(ext_draw_buffers2, 'fbo-drawbuffers2-colormask')
+add_plain_test(ext_draw_buffers2, 'fbo-drawbuffers2-colormask clear')
 
 arb_draw_buffers_blend = Group()
 spec['ARB_draw_buffers_blend'] = arb_draw_buffers_blend
diff --git a/tests/fbo/fbo-drawbuffers2-colormask.c b/tests/fbo/fbo-drawbuffers2-colormask.c
index 086c3fb..f56cfd7 100644
--- a/tests/fbo/fbo-drawbuffers2-colormask.c
+++ b/tests/fbo/fbo-drawbuffers2-colormask.c
@@ -43,6 +43,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+static GLboolean test_clear;
+
 static GLuint
 attach_texture(int i)
 {
@@ -105,8 +107,13 @@ piglit_display(void)
 	glColorMaskIndexedEXT(0, GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE);
 	glColorMaskIndexedEXT(1, GL_FALSE, GL_FALSE, GL_TRUE, GL_FALSE);
 
-	glColor4fv(white);
-	piglit_draw_rect(0, 0, piglit_width, piglit_height);
+	if (test_clear) {
+		glClearColor(1.0, 1.0, 1.0, 1.0);
+		glClear(GL_COLOR_BUFFER_BIT);
+	} else {
+		glColor4fv(white);
+		piglit_draw_rect(0, 0, piglit_width, piglit_height);
+	}
 
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -141,6 +148,14 @@ void
 piglit_init(int argc, char **argv)
 {
 	GLint num;
+	int i;
+
+	for (i = 1; i < argc; i++) {
+		if (strcmp(argv[i], "clear") == 0) {
+			puts("Testing glClear.");
+			test_clear = GL_TRUE;
+		}
+	}
 
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-- 
1.7.10.4



More information about the Piglit mailing list