Actually implement GLX version detection.

macos/v1.5.9
Eric Anholt 11 years ago
parent 75c97229d3
commit 8139c7c489
  1. 27
      src/dispatch_common.c
  2. 2
      src/gen_dispatch.py

@ -141,7 +141,32 @@ epoxy_is_glx(void)
PUBLIC int PUBLIC int
epoxy_glx_version(void) epoxy_glx_version(void)
{ {
return 14; /* XXX */ Display *dpy = glXGetCurrentDisplay();
GLXContext ctx = glXGetCurrentContext();
int server_major, server_minor;
int client_major, client_minor;
int server, client;
const char *version_string;
int screen = 0;
int ret;
/* XXX: What if there's no current context? */
glXQueryContext(dpy, ctx, GLX_SCREEN, &screen);
version_string = glXQueryServerString(dpy, screen, GLX_VERSION);
ret = sscanf(version_string, "%d.%d", &server_major, &server_minor);
assert(ret == 2);
server = server_major * 10 + server_minor;
version_string = glXGetClientString(dpy, GLX_VERSION);
ret = sscanf(version_string, "%d.%d", &client_major, &client_minor);
assert(ret == 2);
client = client_major * 10 + client_minor;
if (client < server)
return client;
else
return server;
} }
static bool static bool

@ -230,7 +230,7 @@ class Generator(object):
elif api == 'glx': elif api == 'glx':
human_name = 'GLX {0}'.format(version) human_name = 'GLX {0}'.format(version)
condition = 'epoxy_is_glx()' condition = 'epoxy_is_glx()'
if version > 12: if version > 13:
condition = condition + ' && epoxy_glx_version() >= {0}'.format(version) condition = condition + ' && epoxy_glx_version() >= {0}'.format(version)
loader = self.dlsym_loader loader = self.dlsym_loader

Loading…
Cancel
Save