st/glx: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values
authorBrian Paul <brianp@vmware.com>
Fri, 4 Jan 2013 00:30:34 +0000 (17:30 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 4 Jan 2013 22:18:53 +0000 (15:18 -0700)
Fixes piglit glx-dont-care-mask test.

Note: This is a candidate for the stable branches.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/gallium/state_trackers/glx/xlib/glx_api.c

index 8e3c6b89f24fab90c8a4b99cdb28554f2c50e2a8..20fae26a4169778513193c793d65c2c555368c42 100644 (file)
@@ -687,6 +687,20 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
 
    while (*parselist) {
 
+      if (fbConfig &&
+          parselist[1] == GLX_DONT_CARE &&
+          parselist[0] != GLX_LEVEL) {
+         /* For glXChooseFBConfig(), skip attributes whose value is
+          * GLX_DONT_CARE, unless it's GLX_LEVEL (which can legitimately be
+          * a negative value).
+          *
+          * From page 17 (23 of the pdf) of the GLX 1.4 spec:
+          * GLX DONT CARE may be specified for all attributes except GLX LEVEL.
+          */
+         parselist += 2;
+         continue;
+      }
+
       switch (*parselist) {
         case GLX_USE_GL:
             if (fbConfig) {