[Piglit] [PATCH 2/4] egl-util.c : Remove hardcoded attributes, use attributes from egl_test structure. For existing tests to work correctly, call eglBindAPI when EGL_RENDERABLE_TYPE is set to EGL_OPENGL_BIT.

Tapani Pälli tapani.palli at intel.com
Tue May 24 01:02:02 PDT 2011


---
 tests/egl/egl-util.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index b7ae4b2..138b3e5 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -35,16 +35,6 @@ static int automatic;
 
 int depth;
 
-static const EGLint attribs[] = {
-	EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT,
-	EGL_RED_SIZE, 1,
-	EGL_GREEN_SIZE, 1,
-	EGL_BLUE_SIZE, 1,
-	EGL_DEPTH_SIZE, 1,
-	EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
-	EGL_NONE
-};
-
 EGLSurface
 egl_util_create_pixmap(struct egl_state *state,
 		       int width, int height, const EGLint *attribs)
@@ -167,7 +157,13 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	eglBindAPI(EGL_OPENGL_API);
+	for (count = 0; test->config_attribs[count] != EGL_NONE; count++) {
+		if (test->config_attribs[count] == EGL_RENDERABLE_TYPE &&
+			test->config_attribs[count+1] == EGL_OPENGL_BIT) {
+			eglBindAPI(EGL_OPENGL_API);
+		}
+	}
+
 
 	state.egl_dpy = eglGetDisplay(state.dpy);
 	if (state.egl_dpy == EGL_NO_DISPLAY) {
@@ -182,7 +178,7 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 
 	check_extensions(&state, test);
 
-	if (!eglChooseConfig(state.egl_dpy, attribs, &state.cfg, 1, &count) ||
+	if (!eglChooseConfig(state.egl_dpy, test->config_attribs, &state.cfg, 1, &count) ||
 	    count == 0) {
 		fprintf(stderr, "eglChooseConfig() failed\n");
 		piglit_report_result(PIGLIT_FAIL);
-- 
1.7.5.1

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the Piglit mailing list