mesa/src/glx/glxglvnddispatchfuncs.h
Kyle Brenneman 22a9e00aab glx: Implement the libglvnd interface.
With reference to the libglvnd branch:

https://cgit.freedesktop.org/mesa/mesa/log/?h=libglvnd

This is a squashed commit containing all of Kyle's commits, all but two
of Emil's commits (to follow), and a small fixup from myself to mark the
rest of the glX* functions as _GLX_PUBLIC so they are not exported when
building for libglvnd. I (ajax) squashed them together both for ease of
review, and because most of the changes are un-useful intermediate
states representing the evolution of glvnd's internal API.

Co-author: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-05-30 16:29:49 +01:00

70 lines
2 KiB
C

#ifndef __glx_glvnd_dispatch_funcs_h__
#define __glx_glvnd_dispatch_funcs_h__
/*
* Helper functions used by g_glxglvnddispatchfuncs.c.
*/
#include "glvnd/libglxabi.h"
#include "glxglvnd.h"
#define __VND __glXGLVNDAPIExports
static inline int AddFBConfigMapping(Display *dpy, GLXFBConfig config,
__GLXvendorInfo *vendor)
{
return __VND->addVendorFBConfigMapping(dpy, config, vendor);
}
static inline int AddFBConfigsMapping(Display *dpy, const GLXFBConfig *ret,
int *nelements, __GLXvendorInfo *vendor)
{
int i, r;
if (!nelements || !ret)
return 0;
for (i = 0; i < *nelements; i++) {
r = __VND->addVendorFBConfigMapping(dpy, ret[i], vendor);
if (r) {
for (; i >= 0; i--)
__VND->removeVendorFBConfigMapping(dpy, ret[i]);
break;
}
}
return r;
}
static inline int AddDrawableMapping(Display *dpy, GLXDrawable drawable,
__GLXvendorInfo *vendor)
{
return __VND->addVendorDrawableMapping(dpy, drawable, vendor);
}
static inline int AddContextMapping(Display *dpy, GLXContext ctx,
__GLXvendorInfo *vendor)
{
return __VND->addVendorContextMapping(dpy, ctx, vendor);
}
static inline __GLXvendorInfo *GetDispatchFromDrawable(Display *dpy,
GLXDrawable drawable)
{
return __VND->vendorFromDrawable(dpy, drawable);
}
static inline __GLXvendorInfo *GetDispatchFromContext(GLXContext ctx)
{
return __VND->vendorFromContext(ctx);
}
static inline __GLXvendorInfo *GetDispatchFromFBConfig(Display *dpy, GLXFBConfig config)
{
return __VND->vendorFromFBConfig(dpy, config);
}
static inline __GLXvendorInfo *GetDispatchFromVisual(Display *dpy,
const XVisualInfo *visual)
{
return __VND->getDynDispatch(dpy, visual->screen);
}
#endif // __glx_glvnd_dispatch_funcs_h__