libGLX: Query the GLX extension when first initializing a display.
libGLX will now call XQueryExtension to check the GLX extension the first time it sees a display. Add the GLX opcode and error base to __GLXdisplayInfo.
This commit is contained in:
parent
a511f3eccb
commit
745f5cf35f
|
@ -56,8 +56,6 @@
|
|||
#define GLX_MAJOR_VERSION 1
|
||||
#define GLX_MINOR_VERSION 4
|
||||
|
||||
#define GLX_EXTENSION_NAME "GLX"
|
||||
|
||||
GLVNDPthreadFuncs __glXPthreadFuncs;
|
||||
|
||||
static glvnd_mutex_t clientStringLock = GLVND_MUTEX_INITIALIZER;
|
||||
|
@ -813,20 +811,17 @@ PUBLIC Bool glXQueryVersion(Display *dpy, int *major, int *minor)
|
|||
*/
|
||||
xGLXQueryVersionReq *req;
|
||||
xGLXQueryVersionReply reply;
|
||||
|
||||
int extMajor, extEvent, extError;
|
||||
__GLXdisplayInfo *dpyInfo = NULL;
|
||||
Bool ret;
|
||||
|
||||
ret = XQueryExtension(dpy, GLX_EXTENSION_NAME, &extMajor, &extEvent, &extError);
|
||||
|
||||
if (ret == False) {
|
||||
/* No extension! */
|
||||
dpyInfo = __glXLookupDisplay(dpy);
|
||||
if (dpyInfo == NULL || !dpyInfo->glxSupported) {
|
||||
return False;
|
||||
}
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(GLXQueryVersion, req);
|
||||
req->reqType = extMajor;
|
||||
req->reqType = dpyInfo->glxMajorOpcode;
|
||||
req->glxCode = X_GLXQueryVersion;
|
||||
req->majorVersion = GLX_MAJOR_VERSION;
|
||||
req->minorVersion = GLX_MINOR_VERSION;
|
||||
|
|
|
@ -68,6 +68,8 @@
|
|||
#define FALLBACK_VENDOR_NAME "indirect"
|
||||
#endif
|
||||
|
||||
#define GLX_EXTENSION_NAME "GLX"
|
||||
|
||||
/*
|
||||
* Hash table containing a mapping from dispatch table index entries to
|
||||
* entry point names. This is used in __glXFetchDispatchEntry() to query
|
||||
|
@ -742,8 +744,15 @@ static __GLXdisplayInfoHash *InitDisplayInfoEntry(Display *dpy)
|
|||
LKDHASH_INIT(__glXPthreadFuncs, pEntry->info.xidScreenHash);
|
||||
__glXPthreadFuncs.rwlock_init(&pEntry->info.vendorLock, NULL);
|
||||
|
||||
// Check whether the server supports the GLX extension, and record the
|
||||
// major opcode if it does.
|
||||
pEntry->info.glxSupported = XQueryExtension(dpy, GLX_EXTENSION_NAME,
|
||||
&pEntry->info.glxMajorOpcode, &eventBase,
|
||||
&pEntry->info.glxFirstError);
|
||||
|
||||
// Check whether the server supports the x11glvnd extension.
|
||||
if (XGLVQueryExtension(dpy, &eventBase, &errorBase)) {
|
||||
pEntry->info.x11glvndSupported = 1;
|
||||
pEntry->info.x11glvndSupported = True;
|
||||
XGLVQueryVersion(dpy, &pEntry->info.x11glvndMajor,
|
||||
&pEntry->info.x11glvndMinor);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,14 @@ typedef struct __GLXdisplayInfoRec {
|
|||
|
||||
DEFINE_LKDHASH(__GLXscreenXIDMappingHash, xidScreenHash);
|
||||
|
||||
int x11glvndSupported;
|
||||
/// True if the server supports the GLX extension.
|
||||
Bool glxSupported;
|
||||
|
||||
/// The major opcode for GLX, if it's supported.
|
||||
int glxMajorOpcode;
|
||||
int glxFirstError;
|
||||
|
||||
Bool x11glvndSupported;
|
||||
int x11glvndMajor;
|
||||
int x11glvndMinor;
|
||||
} __GLXdisplayInfo;
|
||||
|
|
Loading…
Reference in a new issue