/* * This function queries each loaded vendor to determine if there is * a vendor-implemented dispatch function. The dispatch function * uses the vendor <-> API library ABI to determine the screen given * the parameters of the function and dispatch to the correct vendor's * implementation. */ __GLXextFuncPtr __glXGetGLXDispatchAddress(const GLubyte *procName) { __GLXextFuncPtr addr = NULL; __GLXvendorNameHash *pEntry, *tmp; /* * XXX for full correctness, we should probably load vendors * on all screens up-front before doing this. However, that * might be bad for performance? */ LKDHASH_RDLOCK(__glXPthreadFuncs, __glXVendorNameHash); HASH_ITER(hh, _LH(__glXVendorNameHash), pEntry, tmp) { // See if the current vendor supports this GLX entry point addr = pEntry->vendor->staticDispatch-> glxvc.getDispatchAddress(procName); if (addr) { // Allocate the new dispatch index. if (!AllocDispatchIndex(pEntry->vendor, procName)) { addr = NULL; } break; } }
/** * Looks up a dispatch function from a vendor library. * * If the vendor library provides a dispatch function, then it will allocate a * dispatch index for it. * * If the vendor library exports it as a normal OpenGL function, then it will * return a dispatch function from libGLdispatch. * * This function is used from __glXGetGLXDispatchAddress and as the callback to * glvndUpdateEntrypoints. */ static GLVNDentrypointStub __glXFindVendorDispatchAddress(const char *procName, __GLXvendorInfo *vendor) { __GLXextFuncPtr addr = NULL; addr = vendor->staticDispatch-> glxvc.getDispatchAddress((const GLubyte *) procName); if (addr != NULL) { // Allocate the new dispatch index. if (!AllocDispatchIndex(vendor, (const GLubyte *) procName)) { addr = NULL; } return addr; } // If we didn't find a GLX dispatch function, then check for a normal // OpenGL function. This should handle any case where a GL extension // function starts with "glX". addr = vendor->staticDispatch->glxvc.getProcAddress((const GLubyte *) procName); if (addr != NULL) { addr = __glDispatchGetProcAddress(procName); } return addr; }