[Piglit] [PATCH v2 02/13] Add glewInit() calls to glx tests.

Kenneth Graunke kenneth at whitecape.org
Tue Mar 13 15:18:32 PDT 2012


On 03/12/2012 02:41 PM, Paul Berry wrote:
> Previously these tests didn't initialize GLEW, presumably because they
> only use GL 1.0 functions, and those functions bypass GLEW.  But once

I think you're right here (for example, glClear), but note that these 
also call glXGetProcAddress.

Acked-by: Kenneth Graunke <kenneth at whitecape.org>

> we switch to using piglit-dispatch instead of GLEW, we will need to
> initialize it in order for any GL functions to work.  This patch adds
> a call to glewInit() in the place where a call to
> piglit_dispatch_default_init() will eventually be needed.
> ---
>   tests/glx/glx-copy-sub-buffer.c           |    1 +
>   tests/glx/glx-destroycontext-1.c          |    1 +
>   tests/glx/glx-destroycontext-2.c          |    1 +
>   tests/glx/glx-make-current.c              |    1 +
>   tests/glx/glx-make-glxdrawable-current.c  |    1 +
>   tests/glx/glx-multithread-makecurrent-1.c |    1 +
>   tests/glx/glx-multithread-makecurrent-2.c |    1 +
>   tests/glx/glx-multithread-makecurrent-3.c |    1 +
>   tests/glx/glx-multithread-makecurrent-4.c |    1 +
>   tests/glx/glx-multithread.c               |    1 +
>   tests/glx/glx-swap-pixmap-bad.c           |    1 +
>   tests/glx/glx-swap-pixmap.c               |    1 +
>   tests/glx/glx-swap-singlebuffer.c         |    1 +
>   tests/glx/glx-visuals-depth.c             |    1 +
>   tests/glx/glx-visuals-stencil.c           |    1 +
>   15 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/tests/glx/glx-copy-sub-buffer.c b/tests/glx/glx-copy-sub-buffer.c
> index a25b758..a777e05 100644
> --- a/tests/glx/glx-copy-sub-buffer.c
> +++ b/tests/glx/glx-copy-sub-buffer.c
> @@ -52,6 +52,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win_one, ctx);
> +	glewInit();
>
>   	glClearColor(1.0, 0.0, 0.0, 0.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
> diff --git a/tests/glx/glx-destroycontext-1.c b/tests/glx/glx-destroycontext-1.c
> index 8beb1fb..88e46a7 100644
> --- a/tests/glx/glx-destroycontext-1.c
> +++ b/tests/glx/glx-destroycontext-1.c
> @@ -48,6 +48,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>   	glClearColor(1.0, 0.0, 0.0, 1.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
>   	glXMakeCurrent(dpy, None, NULL);
> diff --git a/tests/glx/glx-destroycontext-2.c b/tests/glx/glx-destroycontext-2.c
> index 8da12e9..a4c4d50 100644
> --- a/tests/glx/glx-destroycontext-2.c
> +++ b/tests/glx/glx-destroycontext-2.c
> @@ -48,6 +48,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>   	glClearColor(1.0, 0.0, 0.0, 1.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
>   	glXDestroyContext(dpy, ctx);
> diff --git a/tests/glx/glx-make-current.c b/tests/glx/glx-make-current.c
> index c80776a..d33b7dc 100644
> --- a/tests/glx/glx-make-current.c
> +++ b/tests/glx/glx-make-current.c
> @@ -49,6 +49,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win_one, ctx);
> +	glewInit();
>
>   	glClearColor(0.0, 1.0, 0.0, 1.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
> diff --git a/tests/glx/glx-make-glxdrawable-current.c b/tests/glx/glx-make-glxdrawable-current.c
> index 8050c04..8888fb4 100644
> --- a/tests/glx/glx-make-glxdrawable-current.c
> +++ b/tests/glx/glx-make-glxdrawable-current.c
> @@ -76,6 +76,7 @@ draw(Display *dpy)
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>
>   	glXMakeCurrent(dpy, glxwin_one, ctx);
> +	glewInit();
>
>   	glClearColor(0.0, 1.0, 0.0, 1.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
> diff --git a/tests/glx/glx-multithread-makecurrent-1.c b/tests/glx/glx-multithread-makecurrent-1.c
> index dcfb8db..033e147 100644
> --- a/tests/glx/glx-multithread-makecurrent-1.c
> +++ b/tests/glx/glx-multithread-makecurrent-1.c
> @@ -107,6 +107,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>
>   	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
>
> diff --git a/tests/glx/glx-multithread-makecurrent-2.c b/tests/glx/glx-multithread-makecurrent-2.c
> index 819f5db..7e508f8 100644
> --- a/tests/glx/glx-multithread-makecurrent-2.c
> +++ b/tests/glx/glx-multithread-makecurrent-2.c
> @@ -108,6 +108,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>
>   	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
>
> diff --git a/tests/glx/glx-multithread-makecurrent-3.c b/tests/glx/glx-multithread-makecurrent-3.c
> index 6eaae96..2b655b7 100644
> --- a/tests/glx/glx-multithread-makecurrent-3.c
> +++ b/tests/glx/glx-multithread-makecurrent-3.c
> @@ -100,6 +100,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>
>   	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
>
> diff --git a/tests/glx/glx-multithread-makecurrent-4.c b/tests/glx/glx-multithread-makecurrent-4.c
> index 48e50db..ab7a31d 100644
> --- a/tests/glx/glx-multithread-makecurrent-4.c
> +++ b/tests/glx/glx-multithread-makecurrent-4.c
> @@ -100,6 +100,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>
>   	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
>
> diff --git a/tests/glx/glx-multithread.c b/tests/glx/glx-multithread.c
> index d01c8e9..ee522d8 100644
> --- a/tests/glx/glx-multithread.c
> +++ b/tests/glx/glx-multithread.c
> @@ -79,6 +79,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>
>   	/* Clear background to gray */
>   	glClearColor(0.5, 0.5, 0.5, 1.0);
> diff --git a/tests/glx/glx-swap-pixmap-bad.c b/tests/glx/glx-swap-pixmap-bad.c
> index 614dd6f..5994bff 100644
> --- a/tests/glx/glx-swap-pixmap-bad.c
> +++ b/tests/glx/glx-swap-pixmap-bad.c
> @@ -73,6 +73,7 @@ main(int argc, char **argv)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, g, ctx);
> +	glewInit();
>
>   	/* Clear to green */
>   	glClearColor(0.0, 1.0, 0.0, 0.0);
> diff --git a/tests/glx/glx-swap-pixmap.c b/tests/glx/glx-swap-pixmap.c
> index 1c26a08..0d23302 100644
> --- a/tests/glx/glx-swap-pixmap.c
> +++ b/tests/glx/glx-swap-pixmap.c
> @@ -65,6 +65,7 @@ main(int argc, char **argv)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, g, ctx);
> +	glewInit();
>
>   	/* Clear to green */
>   	glClearColor(0.0, 1.0, 0.0, 0.0);
> diff --git a/tests/glx/glx-swap-singlebuffer.c b/tests/glx/glx-swap-singlebuffer.c
> index b04a44a..ef511e1 100644
> --- a/tests/glx/glx-swap-singlebuffer.c
> +++ b/tests/glx/glx-swap-singlebuffer.c
> @@ -48,6 +48,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> +	glewInit();
>
>   	/* Clear to green */
>   	glClearColor(0.0, 1.0, 0.0, 0.0);
> diff --git a/tests/glx/glx-visuals-depth.c b/tests/glx/glx-visuals-depth.c
> index b263e80..b0bd2d5 100644
> --- a/tests/glx/glx-visuals-depth.c
> +++ b/tests/glx/glx-visuals-depth.c
> @@ -50,6 +50,7 @@ draw(Display *dpy, GLXFBConfig config)
>   	float *left, *right;
>   	bool pass = true;
>
> +	glewInit();
>   	glXGetFBConfigAttrib(dpy, config, GLX_DEPTH_SIZE,&dbits);
>
>   	piglit_ortho_projection(piglit_width, piglit_height, false);
> diff --git a/tests/glx/glx-visuals-stencil.c b/tests/glx/glx-visuals-stencil.c
> index 332fdf6..71beef0 100644
> --- a/tests/glx/glx-visuals-stencil.c
> +++ b/tests/glx/glx-visuals-stencil.c
> @@ -50,6 +50,7 @@ draw(Display *dpy, GLXFBConfig config)
>   	float *left, *right;
>   	bool pass = true;
>
> +	glewInit();
>   	glXGetFBConfigAttrib(dpy, config, GLX_STENCIL_SIZE,&sbits);
>
>   	piglit_ortho_projection(piglit_width, piglit_height, false);



More information about the Piglit mailing list