[Piglit] [PATCH v2 03/13] Add glewInit() calls to GLX_ARB_create_context tests.

Kenneth Graunke kenneth at whitecape.org
Tue Mar 13 15:08:09 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

Au contraire, ARB_create_context is part of OpenGL 3!

In tests/spec/glx_arb_create_context/common.c, you'll find a 
GLX_ARB_create_context_setup function that manually obtains the function 
pointer:

         __piglit_glXCreateContextAttribsARB =
                 (PFNGLXCREATECONTEXTATTRIBSARBPROC)
                 glXGetProcAddress((const GLubyte *)
                                   "glXCreateContextAttribsARB");

I would just do glewInit() there rather than in each individual test.

> 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.
> ---
>   .../glx_arb_create_context/default-major-version.c |    1 +
>   .../glx_arb_create_context/default-minor-version.c |    1 +
>   2 files changed, 2 insertions(+), 0 deletions(-)
>
> 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 f20c912..84de990 100644
> --- a/tests/spec/glx_arb_create_context/default-major-version.c
> +++ b/tests/spec/glx_arb_create_context/default-major-version.c
> @@ -52,6 +52,7 @@ int main(int argc, char **argv)
>   	 */
>   	ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
>   	glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
> +	glewInit();
>
>   	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 4af89c3..c006039 100644
> --- a/tests/spec/glx_arb_create_context/default-minor-version.c
> +++ b/tests/spec/glx_arb_create_context/default-minor-version.c
> @@ -57,6 +57,7 @@ int main(int argc, char **argv)
>   	}
>
>   	glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
> +	glewInit();
>
>   	version_string = (char *) glGetString(GL_VERSION);



More information about the Piglit mailing list