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

Paul Berry stereotype441 at gmail.com
Tue Mar 20 16:08:35 PDT 2012


On 13 March 2012 15:08, Kenneth Graunke <kenneth at whitecape.org> wrote:

> 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 =
>                (**PFNGLXCREATECONTEXTATTRIBSARBP**ROC)
>                glXGetProcAddress((const GLubyte *)
>                                  "glXCreateContextAttribsARB");
>
> I would just do glewInit() there rather than in each individual test.


The problem with doing glewInit() in GLX_ARB_create_context_setup() is that
you can't call glewInit() until after glXMakeContextCurrent() (because
glewInit() makes GL calls) this is true both before and after the
piglit-dispatch rework).  And after the piglit-dispatch rework, it will be
necessary for glewInit() to occur before the call to glGetString().  So
there's really no choice but to put the glewInit() call exactly where it is
in this patch.

If it's all right with you I'll just leave the patch as is and update the
comment.


>
>
>  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);
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120320/ee7caaab/attachment-0001.htm>


More information about the Piglit mailing list