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 11 static inline int AddFBConfigMapping(Display *dpy, GLXFBConfig config, 12 __GLXvendorInfo *vendor) 13 { 14 return __VND->addVendorFBConfigMapping(dpy, config, vendor); 15 } 16 17 static 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 36 static inline int AddDrawableMapping(Display *dpy, GLXDrawable drawable, 37 __GLXvendorInfo *vendor) 38 { 39 return __VND->addVendorDrawableMapping(dpy, drawable, vendor); 40 } 41 42 static inline int AddContextMapping(Display *dpy, GLXContext ctx, 43 __GLXvendorInfo *vendor) 44 { 45 return __VND->addVendorContextMapping(dpy, ctx, vendor); 46 } 47 48 static inline __GLXvendorInfo *GetDispatchFromDrawable(Display *dpy, 49 GLXDrawable drawable) 50 { 51 return __VND->vendorFromDrawable(dpy, drawable); 52 } 53 54 static inline __GLXvendorInfo *GetDispatchFromContext(GLXContext ctx) 55 { 56 return __VND->vendorFromContext(ctx); 57 } 58 59 static inline __GLXvendorInfo *GetDispatchFromFBConfig(Display *dpy, GLXFBConfig config) 60 { 61 return __VND->vendorFromFBConfig(dpy, config); 62 } 63 64 static 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