summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2019-06-20 14:03:36 +0200
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2019-06-22 14:20:05 +0200
commit5bdd8f9d92c8439b6c5ae3c9286ed7f4af3db831 (patch)
treeeaf220bf376c94b6173b0664dec66e574738ce3f
parent037e37a80b5d9a92c41ab0195dda7b704238448b (diff)
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 <erik.faye-lund@collabora.com>
-rw-r--r--tests/fbo/fbo-blending-format-quirks.c16
1 files 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;
}