5 #include "glvnd/libglxabi.h"
9 static Bool
__glXGLVNDIsScreenSupported(Display
*dpy
, int screen
)
11 /* TODO: Think of a better heuristic... */
15 static void *__glXGLVNDGetProcAddress(const GLubyte
*procName
)
17 return glXGetProcAddressARB(procName
);
21 compare(const void *l
, const void *r
)
23 const char *s
= *(const char **)r
;
27 static unsigned FindGLXFunction(const GLubyte
*name
)
31 match
= bsearch(name
, __glXDispatchTableStrings
, DI_FUNCTION_COUNT
,
32 sizeof(const char *), compare
);
35 return DI_FUNCTION_COUNT
;
37 return match
- __glXDispatchTableStrings
;
40 static void *__glXGLVNDGetDispatchAddress(const GLubyte
*procName
)
42 unsigned internalIndex
= FindGLXFunction(procName
);
44 return (void*)__glXDispatchFunctions
[internalIndex
];
47 static void __glXGLVNDSetDispatchIndex(const GLubyte
*procName
, int index
)
49 unsigned internalIndex
= FindGLXFunction(procName
);
51 if (internalIndex
== DI_FUNCTION_COUNT
)
52 return; /* unknown or static dispatch */
54 __glXDispatchTableIndices
[internalIndex
] = index
;
57 _X_EXPORT Bool
__glx_Main(uint32_t version
, const __GLXapiExports
*exports
,
58 __GLXvendorInfo
*vendor
, __GLXapiImports
*imports
)
60 static Bool initDone
= False
;
62 if (GLX_VENDOR_ABI_GET_MAJOR_VERSION(version
) !=
63 GLX_VENDOR_ABI_MAJOR_VERSION
||
64 GLX_VENDOR_ABI_GET_MINOR_VERSION(version
) <
65 GLX_VENDOR_ABI_MINOR_VERSION
)
70 __glXGLVNDAPIExports
= exports
;
72 imports
->isScreenSupported
= __glXGLVNDIsScreenSupported
;
73 imports
->getProcAddress
= __glXGLVNDGetProcAddress
;
74 imports
->getDispatchAddress
= __glXGLVNDGetDispatchAddress
;
75 imports
->setDispatchIndex
= __glXGLVNDSetDispatchIndex
;
76 imports
->notifyError
= NULL
;
77 imports
->isPatchSupported
= NULL
;
78 imports
->initiatePatch
= NULL
;