1#ifndef __glx_glvnd_dispatch_funcs_h__ 2#define __glx_glvnd_dispatch_funcs_h__ 3/* 4 * Helper functions used by g_glxglvnddispatchfuncs.c. 5 */ 6#include "glvnd/libglxabi.h" 7#include "glxglvnd.h" 8 9#define __VND __glXGLVNDAPIExports 10 11static inline int AddFBConfigMapping(Display *dpy, GLXFBConfig config, 12 __GLXvendorInfo *vendor) 13{ 14 return __VND->addVendorFBConfigMapping(dpy, config, vendor); 15} 16 17static inline int AddFBConfigsMapping(Display *dpy, const GLXFBConfig *ret, 18 int *nelements, __GLXvendorInfo *vendor) 19{ 20 int i, r; 21 22 if (!nelements || !ret) 23 return 0; 24 25 for (i = 0; i < *nelements; i++) { 26 r = __VND->addVendorFBConfigMapping(dpy, ret[i], vendor); 27 if (r) { 28 for (; i >= 0; i--) 29 __VND->removeVendorFBConfigMapping(dpy, ret[i]); 30 break; 31 } 32 } 33 return r; 34} 35 36static inline int AddDrawableMapping(Display *dpy, GLXDrawable drawable, 37 __GLXvendorInfo *vendor) 38{ 39 return __VND->addVendorDrawableMapping(dpy, drawable, vendor); 40} 41 42static inline int AddContextMapping(Display *dpy, GLXContext ctx, 43 __GLXvendorInfo *vendor) 44{ 45 return __VND->addVendorContextMapping(dpy, ctx, vendor); 46} 47 48static inline __GLXvendorInfo *GetDispatchFromDrawable(Display *dpy, 49 GLXDrawable drawable) 50{ 51 return __VND->vendorFromDrawable(dpy, drawable); 52} 53 54static inline __GLXvendorInfo *GetDispatchFromContext(GLXContext ctx) 55{ 56 return __VND->vendorFromContext(ctx); 57} 58 59static inline __GLXvendorInfo *GetDispatchFromFBConfig(Display *dpy, GLXFBConfig config) 60{ 61 return __VND->vendorFromFBConfig(dpy, config); 62} 63 64static inline __GLXvendorInfo *GetDispatchFromVisual(Display *dpy, 65 const XVisualInfo *visual) 66{ 67 return __VND->getDynDispatch(dpy, visual->screen); 68} 69 70#endif // __glx_glvnd_dispatch_funcs_h__ 71