1b8e80941Smrg/*
2b8e80941Smrg * THIS FILE IS AUTOMATICALLY GENERATED BY gen_scrn_dispatch.pl
3b8e80941Smrg * DO NOT EDIT!!
4b8e80941Smrg */
5b8e80941Smrg#include <stdlib.h>
6b8e80941Smrg
7b8e80941Smrg#include "glxclient.h"
8b8e80941Smrg#include "glxglvnd.h"
9b8e80941Smrg#include "glxglvnddispatchfuncs.h"
10b8e80941Smrg#include "g_glxglvnddispatchindices.h"
11b8e80941Smrg
12b8e80941Smrgconst int DI_FUNCTION_COUNT = DI_LAST_INDEX;
13b8e80941Smrg/* Allocate an extra 'dummy' to ease lookup. See FindGLXFunction() */
14b8e80941Smrgint __glXDispatchTableIndices[DI_LAST_INDEX + 1];
15b8e80941Smrgconst __GLXapiExports *__glXGLVNDAPIExports;
16b8e80941Smrg
17b8e80941Smrgconst char * const __glXDispatchTableStrings[DI_LAST_INDEX] = {
18b8e80941Smrg#define __ATTRIB(field) \
19b8e80941Smrg    [DI_##field] = "glX"#field
20b8e80941Smrg
21b8e80941Smrg    __ATTRIB(BindSwapBarrierSGIX),
22b8e80941Smrg    __ATTRIB(BindTexImageEXT),
23b8e80941Smrg    // glXChooseFBConfig implemented by libglvnd
24b8e80941Smrg    __ATTRIB(ChooseFBConfigSGIX),
25b8e80941Smrg    // glXChooseVisual implemented by libglvnd
26b8e80941Smrg    // glXCopyContext implemented by libglvnd
27b8e80941Smrg    __ATTRIB(CopySubBufferMESA),
28b8e80941Smrg    // glXCreateContext implemented by libglvnd
29b8e80941Smrg    __ATTRIB(CreateContextAttribsARB),
30b8e80941Smrg    __ATTRIB(CreateContextWithConfigSGIX),
31b8e80941Smrg    __ATTRIB(CreateGLXPbufferSGIX),
32b8e80941Smrg    // glXCreateGLXPixmap implemented by libglvnd
33b8e80941Smrg    __ATTRIB(CreateGLXPixmapMESA),
34b8e80941Smrg    __ATTRIB(CreateGLXPixmapWithConfigSGIX),
35b8e80941Smrg    // glXCreateNewContext implemented by libglvnd
36b8e80941Smrg    // glXCreatePbuffer implemented by libglvnd
37b8e80941Smrg    // glXCreatePixmap implemented by libglvnd
38b8e80941Smrg    // glXCreateWindow implemented by libglvnd
39b8e80941Smrg    // glXDestroyContext implemented by libglvnd
40b8e80941Smrg    __ATTRIB(DestroyGLXPbufferSGIX),
41b8e80941Smrg    // glXDestroyGLXPixmap implemented by libglvnd
42b8e80941Smrg    // glXDestroyPbuffer implemented by libglvnd
43b8e80941Smrg    // glXDestroyPixmap implemented by libglvnd
44b8e80941Smrg    // glXDestroyWindow implemented by libglvnd
45b8e80941Smrg    // glXFreeContextEXT implemented by libglvnd
46b8e80941Smrg    // glXGetClientString implemented by libglvnd
47b8e80941Smrg    // glXGetConfig implemented by libglvnd
48b8e80941Smrg    __ATTRIB(GetContextIDEXT),
49b8e80941Smrg    // glXGetCurrentContext implemented by libglvnd
50b8e80941Smrg    // glXGetCurrentDisplay implemented by libglvnd
51b8e80941Smrg    __ATTRIB(GetCurrentDisplayEXT),
52b8e80941Smrg    // glXGetCurrentDrawable implemented by libglvnd
53b8e80941Smrg    // glXGetCurrentReadDrawable implemented by libglvnd
54b8e80941Smrg    __ATTRIB(GetDriverConfig),
55b8e80941Smrg    // glXGetFBConfigAttrib implemented by libglvnd
56b8e80941Smrg    __ATTRIB(GetFBConfigAttribSGIX),
57b8e80941Smrg    __ATTRIB(GetFBConfigFromVisualSGIX),
58b8e80941Smrg    // glXGetFBConfigs implemented by libglvnd
59b8e80941Smrg    __ATTRIB(GetMscRateOML),
60b8e80941Smrg    // glXGetProcAddress implemented by libglvnd
61b8e80941Smrg    // glXGetProcAddressARB implemented by libglvnd
62b8e80941Smrg    __ATTRIB(GetScreenDriver),
63b8e80941Smrg    // glXGetSelectedEvent implemented by libglvnd
64b8e80941Smrg    __ATTRIB(GetSelectedEventSGIX),
65b8e80941Smrg    __ATTRIB(GetSwapIntervalMESA),
66b8e80941Smrg    __ATTRIB(GetSyncValuesOML),
67b8e80941Smrg    __ATTRIB(GetVideoSyncSGI),
68b8e80941Smrg    // glXGetVisualFromFBConfig implemented by libglvnd
69b8e80941Smrg    __ATTRIB(GetVisualFromFBConfigSGIX),
70b8e80941Smrg    // glXImportContextEXT implemented by libglvnd
71b8e80941Smrg    // glXIsDirect implemented by libglvnd
72b8e80941Smrg    __ATTRIB(JoinSwapGroupSGIX),
73b8e80941Smrg    // glXMakeContextCurrent implemented by libglvnd
74b8e80941Smrg    // glXMakeCurrent implemented by libglvnd
75b8e80941Smrg    // glXQueryContext implemented by libglvnd
76b8e80941Smrg    __ATTRIB(QueryContextInfoEXT),
77b8e80941Smrg    __ATTRIB(QueryCurrentRendererIntegerMESA),
78b8e80941Smrg    __ATTRIB(QueryCurrentRendererStringMESA),
79b8e80941Smrg    // glXQueryDrawable implemented by libglvnd
80b8e80941Smrg    // glXQueryExtension implemented by libglvnd
81b8e80941Smrg    // glXQueryExtensionsString implemented by libglvnd
82b8e80941Smrg    __ATTRIB(QueryGLXPbufferSGIX),
83b8e80941Smrg    __ATTRIB(QueryMaxSwapBarriersSGIX),
84b8e80941Smrg    __ATTRIB(QueryRendererIntegerMESA),
85b8e80941Smrg    __ATTRIB(QueryRendererStringMESA),
86b8e80941Smrg    // glXQueryServerString implemented by libglvnd
87b8e80941Smrg    // glXQueryVersion implemented by libglvnd
88b8e80941Smrg    __ATTRIB(ReleaseBuffersMESA),
89b8e80941Smrg    __ATTRIB(ReleaseTexImageEXT),
90b8e80941Smrg    // glXSelectEvent implemented by libglvnd
91b8e80941Smrg    __ATTRIB(SelectEventSGIX),
92b8e80941Smrg    // glXSwapBuffers implemented by libglvnd
93b8e80941Smrg    __ATTRIB(SwapBuffersMscOML),
94b8e80941Smrg    __ATTRIB(SwapIntervalMESA),
95b8e80941Smrg    __ATTRIB(SwapIntervalSGI),
96b8e80941Smrg    // glXUseXFont implemented by libglvnd
97b8e80941Smrg    __ATTRIB(WaitForMscOML),
98b8e80941Smrg    __ATTRIB(WaitForSbcOML),
99b8e80941Smrg    // glXWaitGL implemented by libglvnd
100b8e80941Smrg    __ATTRIB(WaitVideoSyncSGI),
101b8e80941Smrg    // glXWaitX implemented by libglvnd
102b8e80941Smrg
103b8e80941Smrg#undef __ATTRIB
104b8e80941Smrg};
105b8e80941Smrg
106b8e80941Smrg#define __FETCH_FUNCTION_PTR(func_name) \
107b8e80941Smrg    p##func_name = (void *) \
108b8e80941Smrg        __VND->fetchDispatchEntry(dd, __glXDispatchTableIndices[DI_##func_name])
109b8e80941Smrg
110b8e80941Smrg
111b8e80941Smrgstatic void dispatch_BindTexImageEXT(Display *dpy, GLXDrawable drawable,
112b8e80941Smrg                                     int buffer, const int *attrib_list)
113b8e80941Smrg{
114b8e80941Smrg    PFNGLXBINDTEXIMAGEEXTPROC pBindTexImageEXT;
115b8e80941Smrg    __GLXvendorInfo *dd;
116b8e80941Smrg
117b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
118b8e80941Smrg    if (dd == NULL)
119b8e80941Smrg        return;
120b8e80941Smrg
121b8e80941Smrg    __FETCH_FUNCTION_PTR(BindTexImageEXT);
122b8e80941Smrg    if (pBindTexImageEXT == NULL)
123b8e80941Smrg        return;
124b8e80941Smrg
125b8e80941Smrg    (*pBindTexImageEXT)(dpy, drawable, buffer, attrib_list);
126b8e80941Smrg}
127b8e80941Smrg
128b8e80941Smrg
129b8e80941Smrg
130b8e80941Smrgstatic GLXFBConfigSGIX *dispatch_ChooseFBConfigSGIX(Display *dpy, int screen,
131b8e80941Smrg                                                    int *attrib_list,
132b8e80941Smrg                                                    int *nelements)
133b8e80941Smrg{
134b8e80941Smrg    PFNGLXCHOOSEFBCONFIGSGIXPROC pChooseFBConfigSGIX;
135b8e80941Smrg    __GLXvendorInfo *dd;
136b8e80941Smrg    GLXFBConfigSGIX *ret;
137b8e80941Smrg
138b8e80941Smrg    dd = __VND->getDynDispatch(dpy, screen);
139b8e80941Smrg    if (dd == NULL)
140b8e80941Smrg        return NULL;
141b8e80941Smrg
142b8e80941Smrg    __FETCH_FUNCTION_PTR(ChooseFBConfigSGIX);
143b8e80941Smrg    if (pChooseFBConfigSGIX == NULL)
144b8e80941Smrg        return NULL;
145b8e80941Smrg
146b8e80941Smrg    ret = (*pChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
147b8e80941Smrg    if (AddFBConfigsMapping(dpy, ret, nelements, dd)) {
148b8e80941Smrg        free(ret);
149b8e80941Smrg        return NULL;
150b8e80941Smrg    }
151b8e80941Smrg
152b8e80941Smrg    return ret;
153b8e80941Smrg}
154b8e80941Smrg
155b8e80941Smrg
156b8e80941Smrg
157b8e80941Smrgstatic GLXContext dispatch_CreateContextAttribsARB(Display *dpy,
158b8e80941Smrg                                                   GLXFBConfig config,
159b8e80941Smrg                                                   GLXContext share_list,
160b8e80941Smrg                                                   Bool direct,
161b8e80941Smrg                                                   const int *attrib_list)
162b8e80941Smrg{
163b8e80941Smrg    PFNGLXCREATECONTEXTATTRIBSARBPROC pCreateContextAttribsARB;
164b8e80941Smrg    __GLXvendorInfo *dd;
165b8e80941Smrg    GLXContext ret;
166b8e80941Smrg
167b8e80941Smrg    dd = GetDispatchFromFBConfig(dpy, config);
168b8e80941Smrg    if (dd == NULL)
169b8e80941Smrg        return None;
170b8e80941Smrg
171b8e80941Smrg    __FETCH_FUNCTION_PTR(CreateContextAttribsARB);
172b8e80941Smrg    if (pCreateContextAttribsARB == NULL)
173b8e80941Smrg        return None;
174b8e80941Smrg
175b8e80941Smrg    ret = (*pCreateContextAttribsARB)(dpy, config, share_list, direct, attrib_list);
176b8e80941Smrg    if (AddContextMapping(dpy, ret, dd)) {
177b8e80941Smrg        /* XXX: Call glXDestroyContext which lives in libglvnd. If we're not
178b8e80941Smrg         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
179b8e80941Smrg         */
180b8e80941Smrg        return None;
181b8e80941Smrg    }
182b8e80941Smrg
183b8e80941Smrg    return ret;
184b8e80941Smrg}
185b8e80941Smrg
186b8e80941Smrg
187b8e80941Smrg
188b8e80941Smrgstatic GLXContext dispatch_CreateContextWithConfigSGIX(Display *dpy,
189b8e80941Smrg                                                       GLXFBConfigSGIX config,
190b8e80941Smrg                                                       int render_type,
191b8e80941Smrg                                                       GLXContext share_list,
192b8e80941Smrg                                                       Bool direct)
193b8e80941Smrg{
194b8e80941Smrg    PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC pCreateContextWithConfigSGIX;
195b8e80941Smrg    __GLXvendorInfo *dd;
196b8e80941Smrg    GLXContext ret;
197b8e80941Smrg
198b8e80941Smrg    dd = GetDispatchFromFBConfig(dpy, config);
199b8e80941Smrg    if (dd == NULL)
200b8e80941Smrg        return None;
201b8e80941Smrg
202b8e80941Smrg    __FETCH_FUNCTION_PTR(CreateContextWithConfigSGIX);
203b8e80941Smrg    if (pCreateContextWithConfigSGIX == NULL)
204b8e80941Smrg        return None;
205b8e80941Smrg
206b8e80941Smrg    ret = (*pCreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
207b8e80941Smrg    if (AddContextMapping(dpy, ret, dd)) {
208b8e80941Smrg        /* XXX: Call glXDestroyContext which lives in libglvnd. If we're not
209b8e80941Smrg         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
210b8e80941Smrg         */
211b8e80941Smrg        return None;
212b8e80941Smrg    }
213b8e80941Smrg
214b8e80941Smrg    return ret;
215b8e80941Smrg}
216b8e80941Smrg
217b8e80941Smrg
218b8e80941Smrg
219b8e80941Smrgstatic GLXPbuffer dispatch_CreateGLXPbufferSGIX(Display *dpy,
220b8e80941Smrg                                                GLXFBConfig config,
221b8e80941Smrg                                                unsigned int width,
222b8e80941Smrg                                                unsigned int height,
223b8e80941Smrg                                                int *attrib_list)
224b8e80941Smrg{
225b8e80941Smrg    PFNGLXCREATEGLXPBUFFERSGIXPROC pCreateGLXPbufferSGIX;
226b8e80941Smrg    __GLXvendorInfo *dd;
227b8e80941Smrg    GLXPbuffer ret;
228b8e80941Smrg
229b8e80941Smrg    dd = GetDispatchFromFBConfig(dpy, config);
230b8e80941Smrg    if (dd == NULL)
231b8e80941Smrg        return None;
232b8e80941Smrg
233b8e80941Smrg    __FETCH_FUNCTION_PTR(CreateGLXPbufferSGIX);
234b8e80941Smrg    if (pCreateGLXPbufferSGIX == NULL)
235b8e80941Smrg        return None;
236b8e80941Smrg
237b8e80941Smrg    ret = (*pCreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
238b8e80941Smrg    if (AddDrawableMapping(dpy, ret, dd)) {
239b8e80941Smrg        PFNGLXDESTROYGLXPBUFFERSGIXPROC pDestroyGLXPbufferSGIX;
240b8e80941Smrg
241b8e80941Smrg        __FETCH_FUNCTION_PTR(DestroyGLXPbufferSGIX);
242b8e80941Smrg        if (pDestroyGLXPbufferSGIX)
243b8e80941Smrg            (*pDestroyGLXPbufferSGIX)(dpy, ret);
244b8e80941Smrg
245b8e80941Smrg        return None;
246b8e80941Smrg    }
247b8e80941Smrg
248b8e80941Smrg    return ret;
249b8e80941Smrg}
250b8e80941Smrg
251b8e80941Smrg
252b8e80941Smrg
253b8e80941Smrgstatic GLXPixmap dispatch_CreateGLXPixmapWithConfigSGIX(Display *dpy,
254b8e80941Smrg                                                        GLXFBConfigSGIX config,
255b8e80941Smrg                                                        Pixmap pixmap)
256b8e80941Smrg{
257b8e80941Smrg    PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC pCreateGLXPixmapWithConfigSGIX;
258b8e80941Smrg    __GLXvendorInfo *dd;
259b8e80941Smrg    GLXPixmap ret;
260b8e80941Smrg
261b8e80941Smrg    dd = GetDispatchFromFBConfig(dpy, config);
262b8e80941Smrg    if (dd == NULL)
263b8e80941Smrg        return None;
264b8e80941Smrg
265b8e80941Smrg    __FETCH_FUNCTION_PTR(CreateGLXPixmapWithConfigSGIX);
266b8e80941Smrg    if (pCreateGLXPixmapWithConfigSGIX == NULL)
267b8e80941Smrg        return None;
268b8e80941Smrg
269b8e80941Smrg    ret = (*pCreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
270b8e80941Smrg    if (AddDrawableMapping(dpy, ret, dd)) {
271b8e80941Smrg        /* XXX: Call glXDestroyGLXPixmap which lives in libglvnd. If we're not
272b8e80941Smrg         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
273b8e80941Smrg         */
274b8e80941Smrg        return None;
275b8e80941Smrg    }
276b8e80941Smrg
277b8e80941Smrg    return ret;
278b8e80941Smrg}
279b8e80941Smrg
280b8e80941Smrg
281b8e80941Smrg
282b8e80941Smrgstatic void dispatch_DestroyGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf)
283b8e80941Smrg{
284b8e80941Smrg    PFNGLXDESTROYGLXPBUFFERSGIXPROC pDestroyGLXPbufferSGIX;
285b8e80941Smrg    __GLXvendorInfo *dd;
286b8e80941Smrg
287b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, pbuf);
288b8e80941Smrg    if (dd == NULL)
289b8e80941Smrg        return;
290b8e80941Smrg
291b8e80941Smrg    __FETCH_FUNCTION_PTR(DestroyGLXPbufferSGIX);
292b8e80941Smrg    if (pDestroyGLXPbufferSGIX == NULL)
293b8e80941Smrg        return;
294b8e80941Smrg
295b8e80941Smrg    (*pDestroyGLXPbufferSGIX)(dpy, pbuf);
296b8e80941Smrg}
297b8e80941Smrg
298b8e80941Smrg
299b8e80941Smrg
300b8e80941Smrgstatic GLXContextID dispatch_GetContextIDEXT(const GLXContext ctx)
301b8e80941Smrg{
302b8e80941Smrg    PFNGLXGETCONTEXTIDEXTPROC pGetContextIDEXT;
303b8e80941Smrg    __GLXvendorInfo *dd;
304b8e80941Smrg
305b8e80941Smrg    dd = GetDispatchFromContext(ctx);
306b8e80941Smrg    if (dd == NULL)
307b8e80941Smrg        return None;
308b8e80941Smrg
309b8e80941Smrg    __FETCH_FUNCTION_PTR(GetContextIDEXT);
310b8e80941Smrg    if (pGetContextIDEXT == NULL)
311b8e80941Smrg        return None;
312b8e80941Smrg
313b8e80941Smrg    return (*pGetContextIDEXT)(ctx);
314b8e80941Smrg}
315b8e80941Smrg
316b8e80941Smrg
317b8e80941Smrg
318b8e80941Smrgstatic Display *dispatch_GetCurrentDisplayEXT(void)
319b8e80941Smrg{
320b8e80941Smrg    PFNGLXGETCURRENTDISPLAYEXTPROC pGetCurrentDisplayEXT;
321b8e80941Smrg    __GLXvendorInfo *dd;
322b8e80941Smrg
323b8e80941Smrg    if (!__VND->getCurrentContext())
324b8e80941Smrg        return NULL;
325b8e80941Smrg
326b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
327b8e80941Smrg    if (dd == NULL)
328b8e80941Smrg        return NULL;
329b8e80941Smrg
330b8e80941Smrg    __FETCH_FUNCTION_PTR(GetCurrentDisplayEXT);
331b8e80941Smrg    if (pGetCurrentDisplayEXT == NULL)
332b8e80941Smrg        return NULL;
333b8e80941Smrg
334b8e80941Smrg    return (*pGetCurrentDisplayEXT)();
335b8e80941Smrg}
336b8e80941Smrg
337b8e80941Smrg
338b8e80941Smrg
339b8e80941Smrgstatic const char *dispatch_GetDriverConfig(const char *driverName)
340b8e80941Smrg{
341b8e80941Smrg#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
342b8e80941Smrg    /*
343b8e80941Smrg     * The options are constant for a given driverName, so we do not need
344b8e80941Smrg     * a context (and apps expect to be able to call this without one).
345b8e80941Smrg     */
346b8e80941Smrg    return glXGetDriverConfig(driverName);
347b8e80941Smrg#else
348b8e80941Smrg    return NULL;
349b8e80941Smrg#endif
350b8e80941Smrg}
351b8e80941Smrg
352b8e80941Smrg
353b8e80941Smrg
354b8e80941Smrgstatic int dispatch_GetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config,
355b8e80941Smrg                                          int attribute, int *value_return)
356b8e80941Smrg{
357b8e80941Smrg    PFNGLXGETFBCONFIGATTRIBSGIXPROC pGetFBConfigAttribSGIX;
358b8e80941Smrg    __GLXvendorInfo *dd;
359b8e80941Smrg
360b8e80941Smrg    dd = GetDispatchFromFBConfig(dpy, config);
361b8e80941Smrg    if (dd == NULL)
362b8e80941Smrg        return GLX_NO_EXTENSION;
363b8e80941Smrg
364b8e80941Smrg    __FETCH_FUNCTION_PTR(GetFBConfigAttribSGIX);
365b8e80941Smrg    if (pGetFBConfigAttribSGIX == NULL)
366b8e80941Smrg        return GLX_NO_EXTENSION;
367b8e80941Smrg
368b8e80941Smrg    return (*pGetFBConfigAttribSGIX)(dpy, config, attribute, value_return);
369b8e80941Smrg}
370b8e80941Smrg
371b8e80941Smrg
372b8e80941Smrg
373b8e80941Smrgstatic GLXFBConfigSGIX dispatch_GetFBConfigFromVisualSGIX(Display *dpy,
374b8e80941Smrg                                                          XVisualInfo *vis)
375b8e80941Smrg{
376b8e80941Smrg    PFNGLXGETFBCONFIGFROMVISUALSGIXPROC pGetFBConfigFromVisualSGIX;
377b8e80941Smrg    __GLXvendorInfo *dd;
378b8e80941Smrg    GLXFBConfigSGIX ret = NULL;
379b8e80941Smrg
380b8e80941Smrg    dd = GetDispatchFromVisual(dpy, vis);
381b8e80941Smrg    if (dd == NULL)
382b8e80941Smrg        return NULL;
383b8e80941Smrg
384b8e80941Smrg    __FETCH_FUNCTION_PTR(GetFBConfigFromVisualSGIX);
385b8e80941Smrg    if (pGetFBConfigFromVisualSGIX == NULL)
386b8e80941Smrg        return NULL;
387b8e80941Smrg
388b8e80941Smrg    ret = (*pGetFBConfigFromVisualSGIX)(dpy, vis);
389b8e80941Smrg    if (AddFBConfigMapping(dpy, ret, dd))
390b8e80941Smrg        /* XXX: dealloc ret ? */
391b8e80941Smrg        return NULL;
392b8e80941Smrg
393b8e80941Smrg    return ret;
394b8e80941Smrg}
395b8e80941Smrg
396b8e80941Smrg
397b8e80941Smrg
398b8e80941Smrgstatic void dispatch_GetSelectedEventSGIX(Display *dpy, GLXDrawable drawable,
399b8e80941Smrg                                          unsigned long *mask)
400b8e80941Smrg{
401b8e80941Smrg    PFNGLXGETSELECTEDEVENTSGIXPROC pGetSelectedEventSGIX;
402b8e80941Smrg    __GLXvendorInfo *dd;
403b8e80941Smrg
404b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
405b8e80941Smrg    if (dd == NULL)
406b8e80941Smrg        return;
407b8e80941Smrg
408b8e80941Smrg    __FETCH_FUNCTION_PTR(GetSelectedEventSGIX);
409b8e80941Smrg    if (pGetSelectedEventSGIX == NULL)
410b8e80941Smrg        return;
411b8e80941Smrg
412b8e80941Smrg    (*pGetSelectedEventSGIX)(dpy, drawable, mask);
413b8e80941Smrg}
414b8e80941Smrg
415b8e80941Smrg
416b8e80941Smrg
417b8e80941Smrgstatic int dispatch_GetVideoSyncSGI(unsigned int *count)
418b8e80941Smrg{
419b8e80941Smrg    PFNGLXGETVIDEOSYNCSGIPROC pGetVideoSyncSGI;
420b8e80941Smrg    __GLXvendorInfo *dd;
421b8e80941Smrg
422b8e80941Smrg    if (!__VND->getCurrentContext())
423b8e80941Smrg        return GLX_BAD_CONTEXT;
424b8e80941Smrg
425b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
426b8e80941Smrg    if (dd == NULL)
427b8e80941Smrg        return GLX_NO_EXTENSION;
428b8e80941Smrg
429b8e80941Smrg    __FETCH_FUNCTION_PTR(GetVideoSyncSGI);
430b8e80941Smrg    if (pGetVideoSyncSGI == NULL)
431b8e80941Smrg        return GLX_NO_EXTENSION;
432b8e80941Smrg
433b8e80941Smrg    return (*pGetVideoSyncSGI)(count);
434b8e80941Smrg}
435b8e80941Smrg
436b8e80941Smrg
437b8e80941Smrg
438b8e80941Smrgstatic XVisualInfo *dispatch_GetVisualFromFBConfigSGIX(Display *dpy,
439b8e80941Smrg                                                       GLXFBConfigSGIX config)
440b8e80941Smrg{
441b8e80941Smrg    PFNGLXGETVISUALFROMFBCONFIGSGIXPROC pGetVisualFromFBConfigSGIX;
442b8e80941Smrg    __GLXvendorInfo *dd;
443b8e80941Smrg
444b8e80941Smrg    dd = GetDispatchFromFBConfig(dpy, config);
445b8e80941Smrg    if (dd == NULL)
446b8e80941Smrg        return NULL;
447b8e80941Smrg
448b8e80941Smrg    __FETCH_FUNCTION_PTR(GetVisualFromFBConfigSGIX);
449b8e80941Smrg    if (pGetVisualFromFBConfigSGIX == NULL)
450b8e80941Smrg        return NULL;
451b8e80941Smrg
452b8e80941Smrg    return (*pGetVisualFromFBConfigSGIX)(dpy, config);
453b8e80941Smrg}
454b8e80941Smrg
455b8e80941Smrg
456b8e80941Smrg
457b8e80941Smrgstatic int dispatch_QueryContextInfoEXT(Display *dpy, GLXContext ctx,
458b8e80941Smrg                                        int attribute, int *value)
459b8e80941Smrg{
460b8e80941Smrg    PFNGLXQUERYCONTEXTINFOEXTPROC pQueryContextInfoEXT;
461b8e80941Smrg    __GLXvendorInfo *dd;
462b8e80941Smrg
463b8e80941Smrg    dd = GetDispatchFromContext(ctx);
464b8e80941Smrg    if (dd == NULL)
465b8e80941Smrg        return GLX_NO_EXTENSION;
466b8e80941Smrg
467b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryContextInfoEXT);
468b8e80941Smrg    if (pQueryContextInfoEXT == NULL)
469b8e80941Smrg        return GLX_NO_EXTENSION;
470b8e80941Smrg
471b8e80941Smrg    return (*pQueryContextInfoEXT)(dpy, ctx, attribute, value);
472b8e80941Smrg}
473b8e80941Smrg
474b8e80941Smrg
475b8e80941Smrg
476b8e80941Smrgstatic void dispatch_QueryGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf,
477b8e80941Smrg                                         int attribute, unsigned int *value)
478b8e80941Smrg{
479b8e80941Smrg    PFNGLXQUERYGLXPBUFFERSGIXPROC pQueryGLXPbufferSGIX;
480b8e80941Smrg    __GLXvendorInfo *dd;
481b8e80941Smrg
482b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, pbuf);
483b8e80941Smrg    if (dd == NULL)
484b8e80941Smrg        return;
485b8e80941Smrg
486b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryGLXPbufferSGIX);
487b8e80941Smrg    if (pQueryGLXPbufferSGIX == NULL)
488b8e80941Smrg        return;
489b8e80941Smrg
490b8e80941Smrg    (*pQueryGLXPbufferSGIX)(dpy, pbuf, attribute, value);
491b8e80941Smrg}
492b8e80941Smrg
493b8e80941Smrg
494b8e80941Smrg
495b8e80941Smrgstatic void dispatch_ReleaseTexImageEXT(Display *dpy, GLXDrawable drawable,
496b8e80941Smrg                                        int buffer)
497b8e80941Smrg{
498b8e80941Smrg    PFNGLXRELEASETEXIMAGEEXTPROC pReleaseTexImageEXT;
499b8e80941Smrg    __GLXvendorInfo *dd;
500b8e80941Smrg
501b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
502b8e80941Smrg    if (dd == NULL)
503b8e80941Smrg        return;
504b8e80941Smrg
505b8e80941Smrg    __FETCH_FUNCTION_PTR(ReleaseTexImageEXT);
506b8e80941Smrg    if (pReleaseTexImageEXT == NULL)
507b8e80941Smrg        return;
508b8e80941Smrg
509b8e80941Smrg    (*pReleaseTexImageEXT)(dpy, drawable, buffer);
510b8e80941Smrg}
511b8e80941Smrg
512b8e80941Smrg
513b8e80941Smrg
514b8e80941Smrgstatic void dispatch_SelectEventSGIX(Display *dpy, GLXDrawable drawable,
515b8e80941Smrg                                     unsigned long mask)
516b8e80941Smrg{
517b8e80941Smrg    PFNGLXSELECTEVENTSGIXPROC pSelectEventSGIX;
518b8e80941Smrg    __GLXvendorInfo *dd;
519b8e80941Smrg
520b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
521b8e80941Smrg    if (dd == NULL)
522b8e80941Smrg        return;
523b8e80941Smrg
524b8e80941Smrg    __FETCH_FUNCTION_PTR(SelectEventSGIX);
525b8e80941Smrg    if (pSelectEventSGIX == NULL)
526b8e80941Smrg        return;
527b8e80941Smrg
528b8e80941Smrg    (*pSelectEventSGIX)(dpy, drawable, mask);
529b8e80941Smrg}
530b8e80941Smrg
531b8e80941Smrg
532b8e80941Smrg
533b8e80941Smrgstatic int dispatch_SwapIntervalSGI(int interval)
534b8e80941Smrg{
535b8e80941Smrg    PFNGLXSWAPINTERVALSGIPROC pSwapIntervalSGI;
536b8e80941Smrg    __GLXvendorInfo *dd;
537b8e80941Smrg
538b8e80941Smrg    if (!__VND->getCurrentContext())
539b8e80941Smrg        return GLX_BAD_CONTEXT;
540b8e80941Smrg
541b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
542b8e80941Smrg    if (dd == NULL)
543b8e80941Smrg        return GLX_NO_EXTENSION;
544b8e80941Smrg
545b8e80941Smrg    __FETCH_FUNCTION_PTR(SwapIntervalSGI);
546b8e80941Smrg    if (pSwapIntervalSGI == NULL)
547b8e80941Smrg        return GLX_NO_EXTENSION;
548b8e80941Smrg
549b8e80941Smrg    return (*pSwapIntervalSGI)(interval);
550b8e80941Smrg}
551b8e80941Smrg
552b8e80941Smrg
553b8e80941Smrg
554b8e80941Smrgstatic int dispatch_WaitVideoSyncSGI(int divisor, int remainder,
555b8e80941Smrg                                     unsigned int *count)
556b8e80941Smrg{
557b8e80941Smrg    PFNGLXWAITVIDEOSYNCSGIPROC pWaitVideoSyncSGI;
558b8e80941Smrg    __GLXvendorInfo *dd;
559b8e80941Smrg
560b8e80941Smrg    if (!__VND->getCurrentContext())
561b8e80941Smrg        return GLX_BAD_CONTEXT;
562b8e80941Smrg
563b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
564b8e80941Smrg    if (dd == NULL)
565b8e80941Smrg        return GLX_NO_EXTENSION;
566b8e80941Smrg
567b8e80941Smrg    __FETCH_FUNCTION_PTR(WaitVideoSyncSGI);
568b8e80941Smrg    if (pWaitVideoSyncSGI == NULL)
569b8e80941Smrg        return GLX_NO_EXTENSION;
570b8e80941Smrg
571b8e80941Smrg    return (*pWaitVideoSyncSGI)(divisor, remainder, count);
572b8e80941Smrg}
573b8e80941Smrg
574b8e80941Smrg
575b8e80941Smrg
576b8e80941Smrgstatic void dispatch_BindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable,
577b8e80941Smrg                                            int barrier)
578b8e80941Smrg{
579b8e80941Smrg    PFNGLXBINDSWAPBARRIERSGIXPROC pBindSwapBarrierSGIX;
580b8e80941Smrg    __GLXvendorInfo *dd;
581b8e80941Smrg
582b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
583b8e80941Smrg    if (dd == NULL)
584b8e80941Smrg        return;
585b8e80941Smrg
586b8e80941Smrg    __FETCH_FUNCTION_PTR(BindSwapBarrierSGIX);
587b8e80941Smrg    if (pBindSwapBarrierSGIX == NULL)
588b8e80941Smrg        return;
589b8e80941Smrg
590b8e80941Smrg    (*pBindSwapBarrierSGIX)(dpy, drawable, barrier);
591b8e80941Smrg}
592b8e80941Smrg
593b8e80941Smrg
594b8e80941Smrg
595b8e80941Smrgstatic void dispatch_CopySubBufferMESA(Display *dpy, GLXDrawable drawable,
596b8e80941Smrg                                          int x, int y, int width, int height)
597b8e80941Smrg{
598b8e80941Smrg    PFNGLXCOPYSUBBUFFERMESAPROC pCopySubBufferMESA;
599b8e80941Smrg    __GLXvendorInfo *dd;
600b8e80941Smrg
601b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
602b8e80941Smrg    if (dd == NULL)
603b8e80941Smrg        return;
604b8e80941Smrg
605b8e80941Smrg    __FETCH_FUNCTION_PTR(CopySubBufferMESA);
606b8e80941Smrg    if (pCopySubBufferMESA == NULL)
607b8e80941Smrg        return;
608b8e80941Smrg
609b8e80941Smrg    (*pCopySubBufferMESA)(dpy, drawable, x, y, width, height);
610b8e80941Smrg}
611b8e80941Smrg
612b8e80941Smrg
613b8e80941Smrg
614b8e80941Smrgstatic GLXPixmap dispatch_CreateGLXPixmapMESA(Display *dpy,
615b8e80941Smrg                                                 XVisualInfo *visinfo,
616b8e80941Smrg                                                 Pixmap pixmap, Colormap cmap)
617b8e80941Smrg{
618b8e80941Smrg    PFNGLXCREATEGLXPIXMAPMESAPROC pCreateGLXPixmapMESA;
619b8e80941Smrg    __GLXvendorInfo *dd;
620b8e80941Smrg    GLXPixmap ret;
621b8e80941Smrg
622b8e80941Smrg    dd = GetDispatchFromVisual(dpy, visinfo);
623b8e80941Smrg    if (dd == NULL)
624b8e80941Smrg        return None;
625b8e80941Smrg
626b8e80941Smrg    __FETCH_FUNCTION_PTR(CreateGLXPixmapMESA);
627b8e80941Smrg    if (pCreateGLXPixmapMESA == NULL)
628b8e80941Smrg        return None;
629b8e80941Smrg
630b8e80941Smrg    ret = (*pCreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
631b8e80941Smrg    if (AddDrawableMapping(dpy, ret, dd)) {
632b8e80941Smrg        /* XXX: Call glXDestroyGLXPixmap which lives in libglvnd. If we're not
633b8e80941Smrg         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
634b8e80941Smrg         */
635b8e80941Smrg        return None;
636b8e80941Smrg    }
637b8e80941Smrg
638b8e80941Smrg    return ret;
639b8e80941Smrg}
640b8e80941Smrg
641b8e80941Smrg
642b8e80941Smrg
643b8e80941Smrgstatic GLboolean dispatch_GetMscRateOML(Display *dpy, GLXDrawable drawable,
644b8e80941Smrg                                           int32_t *numerator, int32_t *denominator)
645b8e80941Smrg{
646b8e80941Smrg    PFNGLXGETMSCRATEOMLPROC pGetMscRateOML;
647b8e80941Smrg    __GLXvendorInfo *dd;
648b8e80941Smrg
649b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
650b8e80941Smrg    if (dd == NULL)
651b8e80941Smrg        return GL_FALSE;
652b8e80941Smrg
653b8e80941Smrg    __FETCH_FUNCTION_PTR(GetMscRateOML);
654b8e80941Smrg    if (pGetMscRateOML == NULL)
655b8e80941Smrg        return GL_FALSE;
656b8e80941Smrg
657b8e80941Smrg    return (*pGetMscRateOML)(dpy, drawable, numerator, denominator);
658b8e80941Smrg}
659b8e80941Smrg
660b8e80941Smrg
661b8e80941Smrg
662b8e80941Smrgstatic const char *dispatch_GetScreenDriver(Display *dpy, int scrNum)
663b8e80941Smrg{
664b8e80941Smrg    typedef const char *(*fn_glXGetScreenDriver_ptr)(Display *dpy, int scrNum);
665b8e80941Smrg    fn_glXGetScreenDriver_ptr pGetScreenDriver;
666b8e80941Smrg    __GLXvendorInfo *dd;
667b8e80941Smrg
668b8e80941Smrg    dd = __VND->getDynDispatch(dpy, scrNum);
669b8e80941Smrg    if (dd == NULL)
670b8e80941Smrg        return NULL;
671b8e80941Smrg
672b8e80941Smrg    __FETCH_FUNCTION_PTR(GetScreenDriver);
673b8e80941Smrg    if (pGetScreenDriver == NULL)
674b8e80941Smrg        return NULL;
675b8e80941Smrg
676b8e80941Smrg    return (*pGetScreenDriver)(dpy, scrNum);
677b8e80941Smrg}
678b8e80941Smrg
679b8e80941Smrg
680b8e80941Smrg
681b8e80941Smrgstatic int dispatch_GetSwapIntervalMESA(void)
682b8e80941Smrg{
683b8e80941Smrg    PFNGLXGETSWAPINTERVALMESAPROC pGetSwapIntervalMESA;
684b8e80941Smrg    __GLXvendorInfo *dd;
685b8e80941Smrg
686b8e80941Smrg    if (!__VND->getCurrentContext())
687b8e80941Smrg        return GLX_BAD_CONTEXT;
688b8e80941Smrg
689b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
690b8e80941Smrg    if (dd == NULL)
691b8e80941Smrg        return 0;
692b8e80941Smrg
693b8e80941Smrg    __FETCH_FUNCTION_PTR(GetSwapIntervalMESA);
694b8e80941Smrg    if (pGetSwapIntervalMESA == NULL)
695b8e80941Smrg        return 0;
696b8e80941Smrg
697b8e80941Smrg    return (*pGetSwapIntervalMESA)();
698b8e80941Smrg}
699b8e80941Smrg
700b8e80941Smrg
701b8e80941Smrg
702b8e80941Smrgstatic Bool dispatch_GetSyncValuesOML(Display *dpy, GLXDrawable drawable,
703b8e80941Smrg                                         int64_t *ust, int64_t *msc, int64_t *sbc)
704b8e80941Smrg{
705b8e80941Smrg    PFNGLXGETSYNCVALUESOMLPROC pGetSyncValuesOML;
706b8e80941Smrg    __GLXvendorInfo *dd;
707b8e80941Smrg
708b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
709b8e80941Smrg    if (dd == NULL)
710b8e80941Smrg        return False;
711b8e80941Smrg
712b8e80941Smrg    __FETCH_FUNCTION_PTR(GetSyncValuesOML);
713b8e80941Smrg    if (pGetSyncValuesOML == NULL)
714b8e80941Smrg        return False;
715b8e80941Smrg
716b8e80941Smrg    return (*pGetSyncValuesOML)(dpy, drawable, ust, msc, sbc);
717b8e80941Smrg}
718b8e80941Smrg
719b8e80941Smrg
720b8e80941Smrg
721b8e80941Smrgstatic void dispatch_JoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable,
722b8e80941Smrg                                          GLXDrawable member)
723b8e80941Smrg{
724b8e80941Smrg    PFNGLXJOINSWAPGROUPSGIXPROC pJoinSwapGroupSGIX;
725b8e80941Smrg    __GLXvendorInfo *dd;
726b8e80941Smrg
727b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
728b8e80941Smrg    if (dd == NULL)
729b8e80941Smrg        return;
730b8e80941Smrg
731b8e80941Smrg    __FETCH_FUNCTION_PTR(JoinSwapGroupSGIX);
732b8e80941Smrg    if (pJoinSwapGroupSGIX == NULL)
733b8e80941Smrg        return;
734b8e80941Smrg
735b8e80941Smrg    (*pJoinSwapGroupSGIX)(dpy, drawable, member);
736b8e80941Smrg}
737b8e80941Smrg
738b8e80941Smrg
739b8e80941Smrg
740b8e80941Smrgstatic Bool dispatch_QueryCurrentRendererIntegerMESA(int attribute,
741b8e80941Smrg                                                        unsigned int *value)
742b8e80941Smrg{
743b8e80941Smrg    PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC pQueryCurrentRendererIntegerMESA;
744b8e80941Smrg    __GLXvendorInfo *dd;
745b8e80941Smrg
746b8e80941Smrg    if (!__VND->getCurrentContext())
747b8e80941Smrg        return False;
748b8e80941Smrg
749b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
750b8e80941Smrg    if (dd == NULL)
751b8e80941Smrg        return False;
752b8e80941Smrg
753b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryCurrentRendererIntegerMESA);
754b8e80941Smrg    if (pQueryCurrentRendererIntegerMESA == NULL)
755b8e80941Smrg        return False;
756b8e80941Smrg
757b8e80941Smrg    return (*pQueryCurrentRendererIntegerMESA)(attribute, value);
758b8e80941Smrg}
759b8e80941Smrg
760b8e80941Smrg
761b8e80941Smrg
762b8e80941Smrgstatic const char *dispatch_QueryCurrentRendererStringMESA(int attribute)
763b8e80941Smrg{
764b8e80941Smrg    PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC pQueryCurrentRendererStringMESA;
765b8e80941Smrg    __GLXvendorInfo *dd;
766b8e80941Smrg
767b8e80941Smrg    if (!__VND->getCurrentContext())
768b8e80941Smrg        return NULL;
769b8e80941Smrg
770b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
771b8e80941Smrg    if (dd == NULL)
772b8e80941Smrg        return NULL;
773b8e80941Smrg
774b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryCurrentRendererStringMESA);
775b8e80941Smrg    if (pQueryCurrentRendererStringMESA == NULL)
776b8e80941Smrg        return NULL;
777b8e80941Smrg
778b8e80941Smrg    return (*pQueryCurrentRendererStringMESA)(attribute);
779b8e80941Smrg}
780b8e80941Smrg
781b8e80941Smrg
782b8e80941Smrg
783b8e80941Smrgstatic Bool dispatch_QueryMaxSwapBarriersSGIX(Display *dpy, int screen,
784b8e80941Smrg                                                 int *max)
785b8e80941Smrg{
786b8e80941Smrg    PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC pQueryMaxSwapBarriersSGIX;
787b8e80941Smrg    __GLXvendorInfo *dd;
788b8e80941Smrg
789b8e80941Smrg    dd = __VND->getDynDispatch(dpy, screen);
790b8e80941Smrg    if (dd == NULL)
791b8e80941Smrg        return False;
792b8e80941Smrg
793b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryMaxSwapBarriersSGIX);
794b8e80941Smrg    if (pQueryMaxSwapBarriersSGIX == NULL)
795b8e80941Smrg        return False;
796b8e80941Smrg
797b8e80941Smrg    return (*pQueryMaxSwapBarriersSGIX)(dpy, screen, max);
798b8e80941Smrg}
799b8e80941Smrg
800b8e80941Smrg
801b8e80941Smrg
802b8e80941Smrgstatic Bool dispatch_QueryRendererIntegerMESA(Display *dpy, int screen,
803b8e80941Smrg                                                 int renderer, int attribute,
804b8e80941Smrg                                                 unsigned int *value)
805b8e80941Smrg{
806b8e80941Smrg    PFNGLXQUERYRENDERERINTEGERMESAPROC pQueryRendererIntegerMESA;
807b8e80941Smrg    __GLXvendorInfo *dd;
808b8e80941Smrg
809b8e80941Smrg    dd = __VND->getDynDispatch(dpy, screen);
810b8e80941Smrg    if (dd == NULL)
811b8e80941Smrg        return False;
812b8e80941Smrg
813b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryRendererIntegerMESA);
814b8e80941Smrg    if (pQueryRendererIntegerMESA == NULL)
815b8e80941Smrg        return False;
816b8e80941Smrg
817b8e80941Smrg    return (*pQueryRendererIntegerMESA)(dpy, screen, renderer, attribute, value);
818b8e80941Smrg}
819b8e80941Smrg
820b8e80941Smrg
821b8e80941Smrg
822b8e80941Smrgstatic const char *dispatch_QueryRendererStringMESA(Display *dpy, int screen,
823b8e80941Smrg                                                       int renderer, int attribute)
824b8e80941Smrg{
825b8e80941Smrg    PFNGLXQUERYRENDERERSTRINGMESAPROC pQueryRendererStringMESA;
826b8e80941Smrg    __GLXvendorInfo *dd = NULL;
827b8e80941Smrg
828b8e80941Smrg    dd = __VND->getDynDispatch(dpy, screen);
829b8e80941Smrg    if (dd == NULL)
830b8e80941Smrg        return NULL;
831b8e80941Smrg
832b8e80941Smrg    __FETCH_FUNCTION_PTR(QueryRendererStringMESA);
833b8e80941Smrg    if (pQueryRendererStringMESA == NULL)
834b8e80941Smrg        return NULL;
835b8e80941Smrg
836b8e80941Smrg    return (*pQueryRendererStringMESA)(dpy, screen, renderer, attribute);
837b8e80941Smrg}
838b8e80941Smrg
839b8e80941Smrg
840b8e80941Smrg
841b8e80941Smrgstatic Bool dispatch_ReleaseBuffersMESA(Display *dpy, GLXDrawable d)
842b8e80941Smrg{
843b8e80941Smrg    PFNGLXRELEASEBUFFERSMESAPROC pReleaseBuffersMESA;
844b8e80941Smrg    __GLXvendorInfo *dd;
845b8e80941Smrg
846b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, d);
847b8e80941Smrg    if (dd == NULL)
848b8e80941Smrg        return False;
849b8e80941Smrg
850b8e80941Smrg    __FETCH_FUNCTION_PTR(ReleaseBuffersMESA);
851b8e80941Smrg    if (pReleaseBuffersMESA == NULL)
852b8e80941Smrg        return False;
853b8e80941Smrg
854b8e80941Smrg    return (*pReleaseBuffersMESA)(dpy, d);
855b8e80941Smrg}
856b8e80941Smrg
857b8e80941Smrg
858b8e80941Smrg
859b8e80941Smrgstatic int64_t dispatch_SwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
860b8e80941Smrg                                             int64_t target_msc, int64_t divisor,
861b8e80941Smrg                                             int64_t remainder)
862b8e80941Smrg{
863b8e80941Smrg    PFNGLXSWAPBUFFERSMSCOMLPROC pSwapBuffersMscOML;
864b8e80941Smrg    __GLXvendorInfo *dd;
865b8e80941Smrg
866b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
867b8e80941Smrg    if (dd == NULL)
868b8e80941Smrg        return 0;
869b8e80941Smrg
870b8e80941Smrg    __FETCH_FUNCTION_PTR(SwapBuffersMscOML);
871b8e80941Smrg    if (pSwapBuffersMscOML == NULL)
872b8e80941Smrg        return 0;
873b8e80941Smrg
874b8e80941Smrg    return (*pSwapBuffersMscOML)(dpy, drawable, target_msc, divisor, remainder);
875b8e80941Smrg}
876b8e80941Smrg
877b8e80941Smrg
878b8e80941Smrg
879b8e80941Smrgstatic int dispatch_SwapIntervalMESA(unsigned int interval)
880b8e80941Smrg{
881b8e80941Smrg    PFNGLXSWAPINTERVALMESAPROC pSwapIntervalMESA;
882b8e80941Smrg    __GLXvendorInfo *dd;
883b8e80941Smrg
884b8e80941Smrg    if (!__VND->getCurrentContext())
885b8e80941Smrg        return GLX_BAD_CONTEXT;
886b8e80941Smrg
887b8e80941Smrg    dd = __VND->getCurrentDynDispatch();
888b8e80941Smrg    if (dd == NULL)
889b8e80941Smrg        return 0;
890b8e80941Smrg
891b8e80941Smrg    __FETCH_FUNCTION_PTR(SwapIntervalMESA);
892b8e80941Smrg    if (pSwapIntervalMESA == NULL)
893b8e80941Smrg        return 0;
894b8e80941Smrg
895b8e80941Smrg    return (*pSwapIntervalMESA)(interval);
896b8e80941Smrg}
897b8e80941Smrg
898b8e80941Smrg
899b8e80941Smrg
900b8e80941Smrgstatic Bool dispatch_WaitForMscOML(Display *dpy, GLXDrawable drawable,
901b8e80941Smrg                                      int64_t target_msc, int64_t divisor,
902b8e80941Smrg                                      int64_t remainder, int64_t *ust,
903b8e80941Smrg                                      int64_t *msc, int64_t *sbc)
904b8e80941Smrg{
905b8e80941Smrg    PFNGLXWAITFORMSCOMLPROC pWaitForMscOML;
906b8e80941Smrg    __GLXvendorInfo *dd;
907b8e80941Smrg
908b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
909b8e80941Smrg    if (dd == NULL)
910b8e80941Smrg        return False;
911b8e80941Smrg
912b8e80941Smrg    __FETCH_FUNCTION_PTR(WaitForMscOML);
913b8e80941Smrg    if (pWaitForMscOML == NULL)
914b8e80941Smrg        return False;
915b8e80941Smrg
916b8e80941Smrg    return (*pWaitForMscOML)(dpy, drawable, target_msc, divisor, remainder, ust, msc, sbc);
917b8e80941Smrg}
918b8e80941Smrg
919b8e80941Smrg
920b8e80941Smrg
921b8e80941Smrgstatic Bool dispatch_WaitForSbcOML(Display *dpy, GLXDrawable drawable,
922b8e80941Smrg                                      int64_t target_sbc, int64_t *ust,
923b8e80941Smrg                                      int64_t *msc, int64_t *sbc)
924b8e80941Smrg{
925b8e80941Smrg    PFNGLXWAITFORSBCOMLPROC pWaitForSbcOML;
926b8e80941Smrg    __GLXvendorInfo *dd;
927b8e80941Smrg
928b8e80941Smrg    dd = GetDispatchFromDrawable(dpy, drawable);
929b8e80941Smrg    if (dd == NULL)
930b8e80941Smrg        return False;
931b8e80941Smrg
932b8e80941Smrg    __FETCH_FUNCTION_PTR(WaitForSbcOML);
933b8e80941Smrg    if (pWaitForSbcOML == NULL)
934b8e80941Smrg        return False;
935b8e80941Smrg
936b8e80941Smrg    return (*pWaitForSbcOML)(dpy, drawable, target_sbc, ust, msc, sbc);
937b8e80941Smrg}
938b8e80941Smrg
939b8e80941Smrg#undef __FETCH_FUNCTION_PTR
940b8e80941Smrg
941b8e80941Smrg
942b8e80941Smrg/* Allocate an extra 'dummy' to ease lookup. See FindGLXFunction() */
943b8e80941Smrgconst void * const __glXDispatchFunctions[DI_LAST_INDEX + 1] = {
944b8e80941Smrg#define __ATTRIB(field) \
945b8e80941Smrg    [DI_##field] = (void *)dispatch_##field
946b8e80941Smrg
947b8e80941Smrg    __ATTRIB(BindSwapBarrierSGIX),
948b8e80941Smrg    __ATTRIB(BindTexImageEXT),
949b8e80941Smrg    __ATTRIB(ChooseFBConfigSGIX),
950b8e80941Smrg    __ATTRIB(CopySubBufferMESA),
951b8e80941Smrg    __ATTRIB(CreateContextAttribsARB),
952b8e80941Smrg    __ATTRIB(CreateContextWithConfigSGIX),
953b8e80941Smrg    __ATTRIB(CreateGLXPbufferSGIX),
954b8e80941Smrg    __ATTRIB(CreateGLXPixmapMESA),
955b8e80941Smrg    __ATTRIB(CreateGLXPixmapWithConfigSGIX),
956b8e80941Smrg    __ATTRIB(DestroyGLXPbufferSGIX),
957b8e80941Smrg    __ATTRIB(GetContextIDEXT),
958b8e80941Smrg    __ATTRIB(GetCurrentDisplayEXT),
959b8e80941Smrg    __ATTRIB(GetDriverConfig),
960b8e80941Smrg    __ATTRIB(GetFBConfigAttribSGIX),
961b8e80941Smrg    __ATTRIB(GetFBConfigFromVisualSGIX),
962b8e80941Smrg    __ATTRIB(GetMscRateOML),
963b8e80941Smrg    __ATTRIB(GetScreenDriver),
964b8e80941Smrg    __ATTRIB(GetSelectedEventSGIX),
965b8e80941Smrg    __ATTRIB(GetSwapIntervalMESA),
966b8e80941Smrg    __ATTRIB(GetSyncValuesOML),
967b8e80941Smrg    __ATTRIB(GetVideoSyncSGI),
968b8e80941Smrg    __ATTRIB(GetVisualFromFBConfigSGIX),
969b8e80941Smrg    __ATTRIB(JoinSwapGroupSGIX),
970b8e80941Smrg    __ATTRIB(QueryContextInfoEXT),
971b8e80941Smrg    __ATTRIB(QueryCurrentRendererIntegerMESA),
972b8e80941Smrg    __ATTRIB(QueryCurrentRendererStringMESA),
973b8e80941Smrg    __ATTRIB(QueryGLXPbufferSGIX),
974b8e80941Smrg    __ATTRIB(QueryMaxSwapBarriersSGIX),
975b8e80941Smrg    __ATTRIB(QueryRendererIntegerMESA),
976b8e80941Smrg    __ATTRIB(QueryRendererStringMESA),
977b8e80941Smrg    __ATTRIB(ReleaseBuffersMESA),
978b8e80941Smrg    __ATTRIB(ReleaseTexImageEXT),
979b8e80941Smrg    __ATTRIB(SelectEventSGIX),
980b8e80941Smrg    __ATTRIB(SwapBuffersMscOML),
981b8e80941Smrg    __ATTRIB(SwapIntervalMESA),
982b8e80941Smrg    __ATTRIB(SwapIntervalSGI),
983b8e80941Smrg    __ATTRIB(WaitForMscOML),
984b8e80941Smrg    __ATTRIB(WaitForSbcOML),
985b8e80941Smrg    __ATTRIB(WaitVideoSyncSGI),
986b8e80941Smrg
987b8e80941Smrg    [DI_LAST_INDEX] = NULL,
988b8e80941Smrg#undef __ATTRIB
989b8e80941Smrg};
990