[Piglit] [PATCH 3/3] egl-nok-texture-from-pixmap: Call SwapBuffers after probing back buffer

Michel Dänzer michel at daenzer.net
Tue Aug 23 08:30:34 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

Calling eglSwapBuffers may invalidate the back buffer contents.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 tests/egl/egl-nok-texture-from-pixmap.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/egl/egl-nok-texture-from-pixmap.c b/tests/egl/egl-nok-texture-from-pixmap.c
index 92f7ab7..04cca5c 100644
--- a/tests/egl/egl-nok-texture-from-pixmap.c
+++ b/tests/egl/egl-nok-texture-from-pixmap.c
@@ -46,6 +46,7 @@ draw(struct egl_state *state)
 	EGLint inv;
 	float red[] = { 0.4, 0.0, 0.0, 1.0 };
 	float purple[] = { 0.5, 0.0, 0.5, 1.0 };
+	enum piglit_result result = PIGLIT_PASS;
 
 	if (!eglGetConfigAttrib(state->egl_dpy, state->cfg,
 				EGL_Y_INVERTED_NOK, &inv)) {
@@ -85,7 +86,6 @@ draw(struct egl_state *state)
 
 	eglBindTexImage(state->egl_dpy, pixmap, EGL_BACK_BUFFER);
 	piglit_draw_rect_tex(20, 20, 100, 100,  0, 0, 1, 1);
-	eglSwapBuffers(state->egl_dpy, state->surf);	
 
 	if (!piglit_probe_pixel_rgba(10, 10, red) ||
 	    !piglit_probe_pixel_rgba(50, 10, red) ||
@@ -93,9 +93,11 @@ draw(struct egl_state *state)
 	    !piglit_probe_pixel_rgba(50, 50, purple) ||
 	    !piglit_probe_pixel_rgba(110, 110, purple) ||
 	    !piglit_probe_pixel_rgba(130, 130, red))
-		return PIGLIT_FAIL;
+		result = PIGLIT_FAIL;
+
+	eglSwapBuffers(state->egl_dpy, state->surf);
 
-	return PIGLIT_PASS;
+	return result;
 }
 
 int
-- 
2.9.3



More information about the Piglit mailing list