Fix a similar bug to HEAD~2, this time in epoxy_has_glx_extension().

macos/v1.5.9
Eric Anholt 11 years ago
parent 7603c144db
commit de70a2a0ab
  1. 2
      include/epoxy/glx_common.h
  2. 26
      src/dispatch_common.c
  3. 1
      src/dispatch_common.h
  4. 2
      src/gen_dispatch.py
  5. 2
      test/Makefile.am
  6. 4
      test/glx_has_extension_nocontext.c
  7. 4
      test/glx_public_api.c

@ -34,7 +34,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
bool epoxy_has_glx_extension(const char *extension);
bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension);
int epoxy_glx_version(Display *dpy, int screen);
#endif /* EPOXY_GLX_COMMON_H */

@ -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

@ -50,6 +50,7 @@ bool epoxy_is_glx(void);
void *epoxy_get_proc_address(const char *name);
int epoxy_conservative_glx_version(void);
bool epoxy_conservative_has_glx_extension(const char *name);
void *epoxy_dlsym(const char *name);
void epoxy_glx_autoinit(void);
void epoxy_platform_autoinit(void);

@ -308,7 +308,7 @@ class Generator(object):
apis = extension.get('supported').split('|')
if 'glx' in apis:
human_name = 'GLX extension \\"{0}\\"'.format(extname)
condition = 'epoxy_has_glx_extension("{0}")'.format(extname)
condition = 'epoxy_conservative_has_glx_extension("{0}")'.format(extname)
loader = self.gpa_loader
self.process_require_statements(extension, condition, loader, human_name)
if 'gl' in apis:

@ -38,8 +38,6 @@ TESTS = \
headerguards \
$()
XFAIL_TESTS = glx_has_extension_nocontext
check_PROGRAMS = $(TESTS)
glx_public_api_LDFLAGS = $(X11_LIBS) $(EPOXY) libglx_common.la

@ -46,10 +46,10 @@ main(int argc, char **argv)
dpy = get_display_or_skip();
if (!epoxy_has_glx_extension("GLX_ARB_get_proc_address"))
if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_get_proc_address"))
errx(1, "Implementation reported absence of GLX_ARB_get_proc_address");
if (epoxy_has_glx_extension("GLX_ARB_ham_sandwich"))
if (epoxy_has_glx_extension(dpy, 0, "GLX_ARB_ham_sandwich"))
errx(1, "Implementation reported presence of GLX_ARB_ham_sandwich");
return pass != true;

@ -91,14 +91,14 @@ test_glx_version(void)
static bool
test_glx_extension_supported(void)
{
if (!epoxy_has_glx_extension("GLX_ARB_get_proc_address")) {
if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_get_proc_address")) {
fprintf(stderr,
"Incorrectly reported no support for GLX_ARB_get_proc_address "
"(should always be present in Linux ABI)\n");
return false;
}
if (epoxy_has_glx_extension("GLX_EXT_ham_sandwich")) {
if (epoxy_has_glx_extension(dpy, 0, "GLX_EXT_ham_sandwich")) {
fprintf(stderr,
"Incorrectly reported support for GLX_EXT_ham_sandwich\n");
return false;

Loading…
Cancel
Save