From 5bdd8f9d92c8439b6c5ae3c9286ed7f4af3db831 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 20 Jun 2019 14:03:36 +0200 Subject: tests/fbo: init texture content The "variant 1" subtest uses glBlendFunc(GL_DST_ALPHA, ...) so we must initialize the dst texture or we might get inconsistent results. This fixes random failures on radeonsi hardware. Reviewed-by: Erik Faye-Lund --- tests/fbo/fbo-blending-format-quirks.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/fbo/fbo-blending-format-quirks.c b/tests/fbo/fbo-blending-format-quirks.c index 1e931e970..401a2932e 100644 --- a/tests/fbo/fbo-blending-format-quirks.c +++ b/tests/fbo/fbo-blending-format-quirks.c @@ -81,15 +81,22 @@ test_formats(const char *name, const GLenum formats[2], printf("Testing %s\n", name); - glClearColor(0.0, 0.0, 0.0, 0.5); - glClear(GL_COLOR_BUFFER_BIT); + /* Tets 1 and 2 use glBlendFunc(GL_DST_ALPHA, ...) so make sure alpha + * is initialized to the expected value. + */ + for (i = 0; i < 2; i++) { + glDrawBuffers(1, &draw_bufs[0]); + glClearColor(0.0, 0.0, 0.0, expect[0][3]); + glClear(GL_COLOR_BUFFER_BIT); + } + + glDrawBuffers(2, draw_bufs); glEnable(GL_BLEND); glBlendFunc(factors[0], factors[1]); glBlendColor(1.0, 0.5, 0.25, 0.125); glColor4f(1.0, 1.0, 1.0, 1.0); - glDrawBuffers(2, draw_bufs); piglit_draw_rect(-1.0, -1.0, 2.0, 2.0); glReadBuffer(GL_COLOR_ATTACHMENT0); @@ -106,6 +113,9 @@ test_formats(const char *name, const GLenum formats[2], pass = GL_FALSE; } + glDeleteTextures(2, tex); + glDeleteFramebuffersEXT(1, &fb); + return pass ? PIGLIT_PASS : PIGLIT_FAIL; } -- cgit v1.2.3