summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-03-05 11:21:12 -0800
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-03-05 11:22:05 -0800
commitf846a008e9e63f01bc673e31efd0d6b22e4eb0b9 (patch)
treedc78e5bc66d60a2f300bad005b113203adde40c5 /progs
parent1ca968363dd55e919bd91c8fc31c34d207af3958 (diff)
progs/xdemos: fix up GLX extension checking
A few of my programs were using the client string in addition to the main extensions string to see if a feature was present. Correct this to only check for the currently available and working extensions.
Diffstat (limited to 'progs')
-rw-r--r--progs/xdemos/glsync.c11
-rw-r--r--progs/xdemos/msctest.c13
-rw-r--r--progs/xdemos/omlsync.c9
3 files changed, 6 insertions, 27 deletions
diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c
index c00ba9e468..3751373e23 100644
--- a/progs/xdemos/glsync.c
+++ b/progs/xdemos/glsync.c
@@ -63,10 +63,9 @@ void (*swap_interval)();
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
- const char *extensionsString, *client_extensions, *pos;
+ const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
- client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
@@ -74,12 +73,6 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
- pos = strstr(client_extensions, extension);
-
- if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
- (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
- return 1;
-
return 0;
}
@@ -235,7 +228,7 @@ int main(int argc, char *argv[])
XMapWindow(disp, winGL);
ret = glXMakeCurrent(disp, winGL, context);
- if (ret) {
+ if (!ret) {
fprintf(stderr, "failed to make context current: %d\n", ret);
}
diff --git a/progs/xdemos/msctest.c b/progs/xdemos/msctest.c
index 001ecf04d6..11b0434442 100644
--- a/progs/xdemos/msctest.c
+++ b/progs/xdemos/msctest.c
@@ -45,10 +45,9 @@ void (*wait_sync)(Display *dpy, Window winGL, int64_t target_msc, int64_t diviso
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
- const char *extensionsString, *client_extensions, *pos;
+ const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
- client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
@@ -56,12 +55,6 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
- pos = strstr(client_extensions, extension);
-
- if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
- (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
- return 1;
-
return 0;
}
@@ -167,8 +160,8 @@ int main(int argc, char *argv[])
glXMakeCurrent(disp, winGL, context);
- get_sync_values = glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
- wait_sync = glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
+ get_sync_values = (void *)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
+ wait_sync = (void *)glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
if (!get_sync_values || !wait_sync) {
fprintf(stderr, "failed to get sync values function\n");
diff --git a/progs/xdemos/omlsync.c b/progs/xdemos/omlsync.c
index f2c1d13f81..a2baf4ad72 100644
--- a/progs/xdemos/omlsync.c
+++ b/progs/xdemos/omlsync.c
@@ -73,10 +73,9 @@ int (*glXSwapInterval)(int interval);
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
- const char *extensionsString, *client_extensions, *pos;
+ const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
- client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
@@ -84,12 +83,6 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
- pos = strstr(client_extensions, extension);
-
- if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
- (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
- return 1;
-
return 0;
}