summaryrefslogtreecommitdiff
path: root/src/dispatch_common.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-04 19:07:36 -0800
committerEric Anholt <eric@anholt.net>2013-12-04 19:22:13 -0800
commitde70a2a0abfade6fa3fb4876f4c90e3715e9b70f (patch)
treeb6803aed6c8327485930dcee7b0228101adf1483 /src/dispatch_common.c
parent7603c144db3a5f880f6ce56ccf9eca6c27dc4d70 (diff)
Fix a similar bug to HEAD~2, this time in epoxy_has_glx_extension().
Diffstat (limited to 'src/dispatch_common.c')
-rw-r--r--src/dispatch_common.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index a32b30b..31885fb 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -212,17 +212,29 @@ epoxy_has_egl_extension(const char *ext)
}
#endif
-PUBLIC bool
-epoxy_has_glx_extension(const char *ext)
+/**
+ * If we can determine the GLX extension support from the current
+ * context, then return that, otherwise give the answer that will just
+ * send us on to get_proc_address().
+ */
+bool
+epoxy_conservative_has_glx_extension(const char *ext)
{
Display *dpy = glXGetCurrentDisplay();
- int screen = 0;
+ GLXContext ctx = glXGetCurrentContext();
+ int screen;
- if (!dpy) {
- fprintf(stderr, "waffle needs a display!"); /* XXX */
- return false;
- }
+ if (!dpy || !ctx)
+ return true;
+ glXQueryContext(dpy, ctx, GLX_SCREEN, &screen);
+
+ return epoxy_has_glx_extension(dpy, screen, ext);
+}
+
+PUBLIC bool
+epoxy_has_glx_extension(Display *dpy, int screen, const char *ext)
+{
/* No, you can't just use glXGetClientString or
* glXGetServerString() here. Those each tell you about one half
* of what's needed for an extension to be supported, and