summaryrefslogtreecommitdiffstats
path: root/src/glx/glxglvnddispatchfuncs.h
diff options
context:
space:
mode:
authorKyle Brenneman <[email protected]>2016-05-11 14:01:53 -0400
committerEmil Velikov <[email protected]>2016-05-30 16:29:49 +0100
commit22a9e00aab66d3dd6890e9eaac3f429c0ddec17e (patch)
treecd4568b2381dd25cfa611bc6bc676016d89b6f2f /src/glx/glxglvnddispatchfuncs.h
parentcee459d84de7533d0e0a74a37f7fc4c0f2b77bcf (diff)
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 <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/glx/glxglvnddispatchfuncs.h')
-rw-r--r--src/glx/glxglvnddispatchfuncs.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/glx/glxglvnddispatchfuncs.h b/src/glx/glxglvnddispatchfuncs.h
new file mode 100644
index 00000000000..d9362ff81b4
--- /dev/null
+++ b/src/glx/glxglvnddispatchfuncs.h
@@ -0,0 +1,70 @@
+#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__