[Piglit] [PATCH 1/2] util: Kill macro glewInit

Ian Romanick idr at freedesktop.org
Tue Nov 13 16:39:34 PST 2012


On 11/13/2012 03:59 PM, Chad Versace wrote:
> No test actually called glewInit(), because piglit-dispatch #define'd it
> to piglit_dispatch_default_init().
>
> This patch removes the macro and replaces each call to glewInit() with
> piglit_dispatch_default_init().
>
> CC: Paul Berry <stereotype441 at gmail.com>

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>   tests/general/windowoverlap.c                             | 2 +-
>   tests/glean/tbase.h                                       | 2 +-
>   tests/glx/glx-copy-sub-buffer.c                           | 2 +-
>   tests/glx/glx-destroycontext-1.c                          | 2 +-
>   tests/glx/glx-destroycontext-2.c                          | 2 +-
>   tests/glx/glx-fbo-binding.c                               | 2 +-
>   tests/glx/glx-make-current.c                              | 2 +-
>   tests/glx/glx-make-glxdrawable-current.c                  | 2 +-
>   tests/glx/glx-multi-context-ib-1.c                        | 2 +-
>   tests/glx/glx-multithread-makecurrent-1.c                 | 2 +-
>   tests/glx/glx-multithread-makecurrent-2.c                 | 2 +-
>   tests/glx/glx-multithread-makecurrent-3.c                 | 2 +-
>   tests/glx/glx-multithread-makecurrent-4.c                 | 2 +-
>   tests/glx/glx-multithread.c                               | 2 +-
>   tests/glx/glx-shader-sharing.c                            | 2 +-
>   tests/glx/glx-swap-pixmap-bad.c                           | 2 +-
>   tests/glx/glx-swap-pixmap.c                               | 2 +-
>   tests/glx/glx-swap-singlebuffer.c                         | 2 +-
>   tests/glx/glx-tfp.c                                       | 2 +-
>   tests/glx/glx-visuals-depth.c                             | 2 +-
>   tests/glx/glx-visuals-stencil.c                           | 2 +-
>   tests/spec/glx_arb_create_context/default-major-version.c | 2 +-
>   tests/spec/glx_arb_create_context/default-minor-version.c | 2 +-
>   tests/texturing/getteximage-luminance.c                   | 2 +-
>   tests/util/piglit-dispatch.h                              | 7 -------
>   tests/util/piglit-util-gl.c                               | 4 ++--
>   26 files changed, 26 insertions(+), 33 deletions(-)
>
> diff --git a/tests/general/windowoverlap.c b/tests/general/windowoverlap.c
> index 55a5499..d5fe877 100644
> --- a/tests/general/windowoverlap.c
> +++ b/tests/general/windowoverlap.c
> @@ -181,7 +181,7 @@ int main(int argc, char *argv[])
>   	glutInitWindowSize(MainWidth, MainHeight);
>   	glutInitDisplayMode(PIGLIT_GL_VISUAL_RGB);
>   	glutCreateWindow(argv[0]);
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	glutReshapeFunc(Reshape);
>   	glutDisplayFunc(RedisplayMain);
>   	if (!Automatic)
> diff --git a/tests/glean/tbase.h b/tests/glean/tbase.h
> index 800797a..667a2a9 100644
> --- a/tests/glean/tbase.h
> +++ b/tests/glean/tbase.h
> @@ -319,7 +319,7 @@ public:
>
>   				// Make sure glew is initialized so we can call
>   				// GL functions safely.
> -				glewInit();
> +				piglit_dispatch_default_init();
>
>   				// Check if test is applicable to this context
>   				if (!isApplicable())
> diff --git a/tests/glx/glx-copy-sub-buffer.c b/tests/glx/glx-copy-sub-buffer.c
> index dcd029c..c6561f8 100644
> --- a/tests/glx/glx-copy-sub-buffer.c
> +++ b/tests/glx/glx-copy-sub-buffer.c
> @@ -52,7 +52,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win_one, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	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 eb8557b..91dc82f 100644
> --- a/tests/glx/glx-destroycontext-1.c
> +++ b/tests/glx/glx-destroycontext-1.c
> @@ -48,7 +48,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	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 524ffe7..9c591a0 100644
> --- a/tests/glx/glx-destroycontext-2.c
> +++ b/tests/glx/glx-destroycontext-2.c
> @@ -48,7 +48,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	glClearColor(1.0, 0.0, 0.0, 1.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
>   	glXDestroyContext(dpy, ctx);
> diff --git a/tests/glx/glx-fbo-binding.c b/tests/glx/glx-fbo-binding.c
> index cd5872c..090cd09 100644
> --- a/tests/glx/glx-fbo-binding.c
> +++ b/tests/glx/glx-fbo-binding.c
> @@ -111,7 +111,7 @@ main(int argc, char **argv)
>      ctx = piglit_get_glx_context(dpy, visinfo);
>
>      glXMakeCurrent(dpy, Windows[0], ctx);
> -   glewInit();
> +   piglit_dispatch_default_init();
>
>      piglit_glx_event_loop(dpy, draw);
>
> diff --git a/tests/glx/glx-make-current.c b/tests/glx/glx-make-current.c
> index 59a8863..d56fcdb 100644
> --- a/tests/glx/glx-make-current.c
> +++ b/tests/glx/glx-make-current.c
> @@ -49,7 +49,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win_one, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	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 4164343..919458d 100644
> --- a/tests/glx/glx-make-glxdrawable-current.c
> +++ b/tests/glx/glx-make-glxdrawable-current.c
> @@ -76,7 +76,7 @@ draw(Display *dpy)
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>
>   	glXMakeCurrent(dpy, glxwin_one, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	glClearColor(0.0, 1.0, 0.0, 1.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
> diff --git a/tests/glx/glx-multi-context-ib-1.c b/tests/glx/glx-multi-context-ib-1.c
> index 0f3b428..1e77b7a 100644
> --- a/tests/glx/glx-multi-context-ib-1.c
> +++ b/tests/glx/glx-multi-context-ib-1.c
> @@ -189,7 +189,7 @@ main(int argc, char **argv)
>   	ctx1 = piglit_get_glx_context(dpy, visinfo);
>
>   	glXMakeCurrent(dpy, win, ctx0);
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	piglit_require_extension("GL_ARB_vertex_buffer_object");
>   	context0_init();
>   	glXMakeCurrent(dpy, win, ctx1);
> diff --git a/tests/glx/glx-multithread-makecurrent-1.c b/tests/glx/glx-multithread-makecurrent-1.c
> index 2ab2551..899d607 100644
> --- a/tests/glx/glx-multithread-makecurrent-1.c
> +++ b/tests/glx/glx-multithread-makecurrent-1.c
> @@ -107,7 +107,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	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 a6fc7d7..8f1aa9b 100644
> --- a/tests/glx/glx-multithread-makecurrent-2.c
> +++ b/tests/glx/glx-multithread-makecurrent-2.c
> @@ -108,7 +108,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	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 a4fd736..cf6cb16 100644
> --- a/tests/glx/glx-multithread-makecurrent-3.c
> +++ b/tests/glx/glx-multithread-makecurrent-3.c
> @@ -100,7 +100,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	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 91a897b..bd48f02 100644
> --- a/tests/glx/glx-multithread-makecurrent-4.c
> +++ b/tests/glx/glx-multithread-makecurrent-4.c
> @@ -100,7 +100,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
>
> diff --git a/tests/glx/glx-multithread.c b/tests/glx/glx-multithread.c
> index ca19505..10095f3 100644
> --- a/tests/glx/glx-multithread.c
> +++ b/tests/glx/glx-multithread.c
> @@ -79,7 +79,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	/* Clear background to gray */
>   	glClearColor(0.5, 0.5, 0.5, 1.0);
> diff --git a/tests/glx/glx-shader-sharing.c b/tests/glx/glx-shader-sharing.c
> index 7506d65..c1ed9fa 100644
> --- a/tests/glx/glx-shader-sharing.c
> +++ b/tests/glx/glx-shader-sharing.c
> @@ -88,7 +88,7 @@ draw(Display *dpy)
>       */
>      glXMakeCurrent(dpy, win, ctx1);
>
> -   glewInit();
> +   piglit_dispatch_default_init();
>
>      if (piglit_get_gl_version() < 20) {
>         printf("%s: Requires OpenGL 2.0\n", TestName);
> diff --git a/tests/glx/glx-swap-pixmap-bad.c b/tests/glx/glx-swap-pixmap-bad.c
> index df29626..bc471fc 100644
> --- a/tests/glx/glx-swap-pixmap-bad.c
> +++ b/tests/glx/glx-swap-pixmap-bad.c
> @@ -73,7 +73,7 @@ main(int argc, char **argv)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, g, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	/* 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 a4dfb5c..1a91578 100644
> --- a/tests/glx/glx-swap-pixmap.c
> +++ b/tests/glx/glx-swap-pixmap.c
> @@ -65,7 +65,7 @@ main(int argc, char **argv)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, g, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	/* 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 78cdf21..73a065d 100644
> --- a/tests/glx/glx-swap-singlebuffer.c
> +++ b/tests/glx/glx-swap-singlebuffer.c
> @@ -48,7 +48,7 @@ draw(Display *dpy)
>
>   	ctx = piglit_get_glx_context(dpy, visinfo);
>   	glXMakeCurrent(dpy, win, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	/* Clear to green */
>   	glClearColor(0.0, 1.0, 0.0, 0.0);
> diff --git a/tests/glx/glx-tfp.c b/tests/glx/glx-tfp.c
> index 0f99974..659c452 100644
> --- a/tests/glx/glx-tfp.c
> +++ b/tests/glx/glx-tfp.c
> @@ -320,7 +320,7 @@ int main(int argc, char**argv)
>
>   	glXMakeCurrent(dpy, win, ctx);
>
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	if (piglit_automatic)
>   		piglit_glx_set_no_input();
> diff --git a/tests/glx/glx-visuals-depth.c b/tests/glx/glx-visuals-depth.c
> index ba147e2..e7dad45 100644
> --- a/tests/glx/glx-visuals-depth.c
> +++ b/tests/glx/glx-visuals-depth.c
> @@ -50,7 +50,7 @@ draw(Display *dpy, GLXFBConfig config)
>   	float *left, *right;
>   	bool pass = true;
>
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	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 ecbe5cd..d82675b 100644
> --- a/tests/glx/glx-visuals-stencil.c
> +++ b/tests/glx/glx-visuals-stencil.c
> @@ -50,7 +50,7 @@ draw(Display *dpy, GLXFBConfig config)
>   	float *left, *right;
>   	bool pass = true;
>
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	glXGetFBConfigAttrib(dpy, config, GLX_STENCIL_SIZE, &sbits);
>
>   	piglit_ortho_projection(piglit_width, piglit_height, false);
> diff --git a/tests/spec/glx_arb_create_context/default-major-version.c b/tests/spec/glx_arb_create_context/default-major-version.c
> index 50b5ff6..df6aabd 100644
> --- a/tests/spec/glx_arb_create_context/default-major-version.c
> +++ b/tests/spec/glx_arb_create_context/default-major-version.c
> @@ -52,7 +52,7 @@ int main(int argc, char **argv)
>   	 */
>   	ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
>   	glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	version_string = (char *) glGetString(GL_VERSION);
>
> diff --git a/tests/spec/glx_arb_create_context/default-minor-version.c b/tests/spec/glx_arb_create_context/default-minor-version.c
> index 69a7ecf..35c800e 100644
> --- a/tests/spec/glx_arb_create_context/default-minor-version.c
> +++ b/tests/spec/glx_arb_create_context/default-minor-version.c
> @@ -57,7 +57,7 @@ int main(int argc, char **argv)
>   	}
>
>   	glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
> -	glewInit();
> +	piglit_dispatch_default_init();
>
>   	version_string = (char *) glGetString(GL_VERSION);
>
> diff --git a/tests/texturing/getteximage-luminance.c b/tests/texturing/getteximage-luminance.c
> index 024a5bd..7c752dc 100644
> --- a/tests/texturing/getteximage-luminance.c
> +++ b/tests/texturing/getteximage-luminance.c
> @@ -251,5 +251,5 @@ piglit_display(void)
>   void
>   piglit_init(int argc, char **argv)
>   {
> -	glewInit();
> +	piglit_dispatch_default_init();
>   }
> diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h
> index ef2687a..ee5f863 100644
> --- a/tests/util/piglit-dispatch.h
> +++ b/tests/util/piglit-dispatch.h
> @@ -155,13 +155,6 @@ piglit_dispatch_resolve_function(const char *name);
>
>   void piglit_dispatch_default_init();
>
> -/* As a temporary measure, redirect glewInit() to
> - * piglit_dispatch_default_init(), so that we don't have to modify
> - * initialization code in old tests that were written before the
> - * piglit-dispatch mechanism.
> - */
> -#define glewInit piglit_dispatch_default_init
> -
>   /* Prevent gl.h from being included, since it will attempt to define
>    * the functions we've already defined.
>    */
> diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
> index 8565168..25a7e75 100644
> --- a/tests/util/piglit-util-gl.c
> +++ b/tests/util/piglit-util-gl.c
> @@ -714,7 +714,7 @@ int piglit_use_fragment_program(void)
>   		"END\n"
>   		;
>
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	if (!piglit_is_extension_supported("GL_ARB_fragment_program"))
>   		return 0;
>
> @@ -735,7 +735,7 @@ void piglit_require_fragment_program(void)
>
>   int piglit_use_vertex_program(void)
>   {
> -	glewInit();
> +	piglit_dispatch_default_init();
>   	return piglit_is_extension_supported("GL_ARB_vertex_program");
>   }
>
>



More information about the Piglit mailing list