[Piglit] [PATCH V2] egl_util : support for es1 and es2 tests

Tapani Pälli tapani.palli at intel.com
Fri Jan 17 01:07:57 PST 2014


egl_util was hardcoded to use PIGLIT_DISPATCH_GL, now code makes
decision based on config attribs set by the test.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---

oops, typo with 'dispatch_api' fixed

 tests/egl/egl-util.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index 012f547..4989b9f 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -187,7 +187,7 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 	struct egl_state state;
 	EGLint count;
 	enum piglit_result result;
-	int i;
+	int i, api_bit, dispatch_api;
 
 	for (i = 1; i < argc; ++i) {
 		if (!strcmp(argv[i], "-auto"))
@@ -203,13 +203,15 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 	}
 
 	for (count = 0; test->config_attribs[count] != EGL_NONE; count += 2) {
-		if (test->config_attribs[count] == EGL_RENDERABLE_TYPE &&
-		    test->config_attribs[count+1] == EGL_OPENGL_BIT) {
-			eglBindAPI(EGL_OPENGL_API);
+		if (test->config_attribs[count] == EGL_RENDERABLE_TYPE) {
+			api_bit = test->config_attribs[count+1];
+			if (api_bit == EGL_OPENGL_BIT)
+				eglBindAPI(EGL_OPENGL_API);
+			else
+				eglBindAPI(EGL_OPENGL_ES_API);
 		}
 	}
 
-
 	state.egl_dpy = eglGetDisplay(state.dpy);
 	if (state.egl_dpy == EGL_NO_DISPLAY) {
 		fprintf(stderr, "eglGetDisplay() failed\n");
@@ -253,7 +255,19 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
+	/* choose dispatch init */
+	switch (api_bit) {
+	case EGL_OPENGL_ES_BIT:
+		dispatch_api = PIGLIT_DISPATCH_ES1;
+		break;
+	case EGL_OPENGL_ES2_BIT:
+		dispatch_api = PIGLIT_DISPATCH_ES2;
+		break;
+	default:
+		dispatch_api = PIGLIT_DISPATCH_GL;
+	}
+
+	piglit_dispatch_default_init(dispatch_api);
 
 	result = event_loop(&state, test);
 
-- 
1.8.3.1



More information about the Piglit mailing list