[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.
Chad Versace
chad at chad-versace.us
Fri May 27 14:03:46 PDT 2011
On 05/24/2011 01:02 AM, Tapani Pälli wrote:
> ---
> 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++) {
^^^^^^^
This should be count += 2, because an EGL attribute map consists of
key/value pairs. You want to only test keys for EGL_NONE and skip the
values.
> + if (test->config_attribs[count] == EGL_RENDERABLE_TYPE &&
> + test->config_attribs[count+1] == EGL_OPENGL_BIT) {
^^^^
The prevailing style in egl-util.c is that successive lines like this
are aligned against the paren. Remove the whitespace.
> + 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);
--
Chad Versace
chad at chad-versace.us
More information about the Piglit
mailing list