summaryrefslogtreecommitdiffstats
path: root/src/glx/glxglvnddispatchfuncs.h
blob: d9362ff81b4fdf92d1deefe6b08c24beb966310b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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__