On 13 March 2012 15:08, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 03/12/2012 02:41 PM, Paul Berry wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Previously these tests didn't initialize GLEW, presumably because they<br>
only use GL 1.0 functions, and those functions bypass GLEW. But once<br>
</blockquote>
<br></div>
Au contraire, ARB_create_context is part of OpenGL 3!<br>
<br>
In tests/spec/glx_arb_create_<u></u>context/common.c, you'll find a GLX_ARB_create_context_setup function that manually obtains the function pointer:<br>
<br>
__piglit_<u></u>glXCreateContextAttribsARB =<br>
(<u></u>PFNGLXCREATECONTEXTATTRIBSARBP<u></u>ROC)<br>
glXGetProcAddress((const GLubyte *)<br>
"glXCreateContextAttribsARB");<br>
<br>
I would just do glewInit() there rather than in each individual test.</blockquote><div><br>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.<br>
<br>If it's all right with you I'll just leave the patch as is and update the comment.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
we switch to using piglit-dispatch instead of GLEW, we will need to<br>
initialize it in order for any GL functions to work. This patch adds<br>
a call to glewInit() in the place where a call to<br>
piglit_dispatch_default_init() will eventually be needed.<br>
---<br>
.../glx_arb_create_context/<u></u>default-major-version.c | 1 +<br>
.../glx_arb_create_context/<u></u>default-minor-version.c | 1 +<br>
2 files changed, 2 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/tests/spec/glx_arb_create_<u></u>context/default-major-version.<u></u>c b/tests/spec/glx_arb_create_<u></u>context/default-major-version.<u></u>c<br>
index f20c912..84de990 100644<br>
--- a/tests/spec/glx_arb_create_<u></u>context/default-major-version.<u></u>c<br>
+++ b/tests/spec/glx_arb_create_<u></u>context/default-major-version.<u></u>c<br>
@@ -52,6 +52,7 @@ int main(int argc, char **argv)<br>
*/<br>
ctx = glXCreateContextAttribsARB(<u></u>dpy, fbconfig, NULL, True, attribs);<br>
glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);<br>
+ glewInit();<br>
<br>
version_string = (char *) glGetString(GL_VERSION);<br>
<br>
diff --git a/tests/spec/glx_arb_create_<u></u>context/default-minor-version.<u></u>c b/tests/spec/glx_arb_create_<u></u>context/default-minor-version.<u></u>c<br>
index 4af89c3..c006039 100644<br>
--- a/tests/spec/glx_arb_create_<u></u>context/default-minor-version.<u></u>c<br>
+++ b/tests/spec/glx_arb_create_<u></u>context/default-minor-version.<u></u>c<br>
@@ -57,6 +57,7 @@ int main(int argc, char **argv)<br>
}<br>
<br>
glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);<br>
+ glewInit();<br>
<br>
version_string = (char *) glGetString(GL_VERSION);<br>
</blockquote>
<br>
</div></div></blockquote></div><br>