summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-07-04 07:43:01 +0200
committerJakob Bornecrantz <jakob@vmware.com>2009-07-04 07:43:01 +0200
commit28471cfa970702128d822c2ecbb1703eedbca245 (patch)
treefa91f0d366ba857e228946ac88966e1717dc879f /progs
parent9982821cdaf2205443c6297368eaab4115bf92f6 (diff)
parent71633abafc935c25da9731bab48c228ceb9b4097 (diff)
Merge branch 'mesa_7_5_branch'
Diffstat (limited to 'progs')
-rw-r--r--progs/xdemos/glxgears.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/progs/xdemos/glxgears.c b/progs/xdemos/glxgears.c
index 2dc157a890..bc84ee3dbd 100644
--- a/progs/xdemos/glxgears.c
+++ b/progs/xdemos/glxgears.c
@@ -39,6 +39,12 @@
#include <GL/gl.h>
#include <GL/glx.h>
+#ifndef GLX_MESA_swap_control
+#define GLX_MESA_swap_control 1
+typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
+#endif
+
+
static int is_glx_extension_supported(Display *dpy, const char *query);
static void query_vsync(Display *dpy);
@@ -592,31 +598,22 @@ query_vsync(Display *dpy)
int interval = 0;
-#ifdef GLX_MESA_swap_control
- if ((interval <= 0)
- && is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
+ if (is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA =
(PFNGLXGETSWAPINTERVALMESAPROC)
glXGetProcAddressARB((const GLubyte *) "glXGetSwapIntervalMESA");
interval = (*pglXGetSwapIntervalMESA)();
+ } else if (is_glx_extension_supported(dpy, "GLX_SGI_swap_control")) {
+ /* The default swap interval with this extension is 1. Assume that it
+ * is set to the default.
+ *
+ * Many Mesa-based drivers default to 0, but all of these drivers also
+ * export GLX_MESA_swap_control. In that case, this branch will never
+ * be taken, and the correct result should be reported.
+ */
+ interval = 1;
}
-#endif
-
-
-#ifdef GLX_SGI_video_sync
- if ((interval <= 0)
- && is_glx_extension_supported(dpy, "GLX_SGI_video_sync")) {
- PFNGLXGETVIDEOSYNCSGIPROC pglXGetVideoSyncSGI =
- (PFNGLXGETVIDEOSYNCSGIPROC)
- glXGetProcAddressARB((const GLubyte *) "glXGetVideoSyncSGI");
- unsigned count;
-
- if ((*pglXGetVideoSyncSGI)(& count) == 0) {
- interval = (int) count;
- }
- }
-#endif
if (interval > 0) {