On 06/12/2011 12:56 PM, Gustaw Smolarczyk wrote:
I found some bugs in this code.

2011/6/11 Brian Paul<bri...@vmware.com>:
The -c flag says to try to create a core profile (no legacy features)
using glXCreateContextAttribsARB().  A core profile may advertise a
different set of extensions than a compatibility profile (though,
the only difference with NVIDIA's driver is the presence of
GL_ARB_compatibility).  Also note that extensions need to be queried
one at a time with glGetStringi().


+   /* install X error handler */
+   old_handler = XSetErrorHandler(create_context_error_handler);
+   CreateContextErrorFlag = False;
+
+   /* try creating context */
+   context = glXCreateContextAttribsARB_func(dpy,
+                                             fbconfig,
+                                             0, /* share_context */
+                                             True, /* direct */
+                                             attribs);
+
+   /* restore error handler */
+   XSetErrorHandler(old_handler);
+
+   if (CreateContextErrorFlag)
+      context = 0;

The context should be tested against being direct. For example, fglrx
will happily create "4.2" context, but it will be just default
indirect one.

So you see "OpenGL version string: 4.2" in the output? That really shouldn't happen. Seems like that's a fgrlx bug.



+   if (coreProfile) {
+      /* Try to create a core profile, starting with the newest version of
+       * GL that we're aware of.  If we don't specify the version
+       */
+      int i;
+      for (i = NUM_GL_VERSIONS - 2; i>  0 ; i--) {
+         ctx = create_context_flags(dpy, config,
+                                    gl_versions[i].major,
+                                    gl_versions[i].minor,
+                                    0x0,
+                                    GLX_CONTEXT_CORE_PROFILE_BIT_ARB);
+         if (ctx)
+            break;
+      }
+      if (!ctx) {
+         /* couldn't get core profile context */
+         return 0;
+      }

There's something missing here. If ctx is not NULL, it will be
overwritten by code below. There should be "return ctx;" line here
IMHO.

Thanks. I was mucking with that right before I quit for the day and posted my patch. I'll fix it.

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to