+#endif /* !HAVE_GL */
+
+ return 0;
+}
+
+
+void
+describe_gl_visual (FILE *f, Screen *screen, Visual *visual,
+ Bool private_cmap_p)
+{
+ describe_visual (f, screen, visual, private_cmap_p);
+
+#ifdef HAVE_GL
+ {
+ int status;
+ int value = False;
+
+ Display *dpy = DisplayOfScreen (screen);
+ XVisualInfo vi_in, *vi_out;
+ int out_count;
+
+ vi_in.screen = screen_number (screen);
+ vi_in.visualid = XVisualIDFromVisual (visual);
+ vi_out = XGetVisualInfo (dpy, (VisualScreenMask | VisualIDMask),
+ &vi_in, &out_count);
+ if (! vi_out) abort ();
+
+ status = glXGetConfig (dpy, vi_out, GLX_USE_GL, &value);
+
+ if (status == GLX_NO_EXTENSION)
+ /* dpy does not support the GLX extension. */
+ return;
+
+ if (status == GLX_BAD_VISUAL || value == False)
+ /* this visual does not support GLX. */
+ return;
+
+ if (!glXGetConfig (dpy, vi_out, GLX_LEVEL, &value) &&
+ value != 0)
+ printf (" GLX level: %d\n", value);
+
+ if (!glXGetConfig (dpy, vi_out, GLX_RGBA, &value) && value)
+ {
+ int r=0, g=0, b=0, a=0;
+ glXGetConfig (dpy, vi_out, GLX_RED_SIZE, &r);
+ glXGetConfig (dpy, vi_out, GLX_GREEN_SIZE, &g);
+ glXGetConfig (dpy, vi_out, GLX_BLUE_SIZE, &b);
+ glXGetConfig (dpy, vi_out, GLX_ALPHA_SIZE, &a);
+ printf (" GLX type: RGBA (%2d, %2d, %2d, %2d)\n",
+ r, g, b, a);
+
+ r=0, g=0, b=0, a=0;
+ glXGetConfig (dpy, vi_out, GLX_ACCUM_RED_SIZE, &r);
+ glXGetConfig (dpy, vi_out, GLX_ACCUM_GREEN_SIZE, &g);
+ glXGetConfig (dpy, vi_out, GLX_ACCUM_BLUE_SIZE, &b);
+ glXGetConfig (dpy, vi_out, GLX_ACCUM_ALPHA_SIZE, &a);
+ printf (" GLX accum: RGBA (%2d, %2d, %2d, %2d)\n",
+ r, g, b, a);
+ }
+ else
+ {
+ value = 0;
+ glXGetConfig (dpy, vi_out, GLX_BUFFER_SIZE, &value);
+ printf (" GLX type: indexed (%d)\n", value);
+ }
+
+# ifdef GLX_VISUAL_CAVEAT_EXT
+ if (!glXGetConfig (dpy, vi_out, GLX_VISUAL_CAVEAT_EXT, &value) &&
+ value != GLX_NONE_EXT)
+# ifdef GLX_NON_CONFORMANT_EXT
+ printf (" GLX rating: %s\n",
+ (value == GLX_NONE_EXT ? "none" :
+ value == GLX_SLOW_VISUAL_EXT ? "slow" :
+ value == GLX_NON_CONFORMANT_EXT ? "non-conformant" :
+ "???"));
+# else
+ printf (" GLX rating: %s\n",
+ (value == GLX_NONE_EXT ? "none" :
+ value == GLX_SLOW_VISUAL_EXT ? "slow" :
+ "???"));
+# endif /* GLX_NON_CONFORMANT_EXT */
+# endif /* GLX_VISUAL_CAVEAT_EXT */
+
+ if (!glXGetConfig (dpy, vi_out, GLX_DOUBLEBUFFER, &value))
+ printf (" GLX double-buffer: %s\n", (value ? "yes" : "no"));
+
+ if (!glXGetConfig (dpy, vi_out, GLX_STEREO, &value) &&
+ value)
+ printf (" GLX stereo: %s\n", (value ? "yes" : "no"));
+
+ if (!glXGetConfig (dpy, vi_out, GLX_AUX_BUFFERS, &value) &&
+ value != 0)
+ printf (" GLX aux buffers: %d\n", value);