Pull a helper function from piglit.

I need this for doing testing against core contexts.
macos/v1.5.9
Eric Anholt 11 years ago
parent f2d5248e3d
commit a258cdcffe
  1. 28
      test/glx_common.c
  2. 2
      test/glx_common.h

@ -1,5 +1,5 @@
/*
* Copyright © 2013 Intel Corporation
* Copyright © 2009, 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -102,3 +102,29 @@ make_glx_context_current_or_skip(Display *dpy)
glXMakeCurrent(dpy, win, ctx);
}
GLXFBConfig
get_fbconfig_for_visinfo(Display *dpy, XVisualInfo *visinfo)
{
int i, nconfigs;
GLXFBConfig ret = None, *configs;
configs = glXGetFBConfigs(dpy, visinfo->screen, &nconfigs);
if (!configs)
return None;
for (i = 0; i < nconfigs; i++) {
int v;
if (glXGetFBConfigAttrib(dpy, configs[i], GLX_VISUAL_ID, &v))
continue;
if (v == visinfo->visualid) {
ret = configs[i];
break;
}
}
XFree(configs);
return ret;
}

@ -29,3 +29,5 @@ get_display_or_skip(void);
GLXContext
make_glx_context_current_or_skip(Display *dpy);
GLXFBConfig
get_fbconfig_for_visual(XVisualInfo *visinfo);

Loading…
Cancel
Save