summaryrefslogtreecommitdiff
path: root/xc/lib/GL/glx/glxcmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/glx/glxcmds.c')
-rw-r--r--xc/lib/GL/glx/glxcmds.c74
1 files changed, 47 insertions, 27 deletions
diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c
index 6ac7e06b7..d08f2727a 100644
--- a/xc/lib/GL/glx/glxcmds.c
+++ b/xc/lib/GL/glx/glxcmds.c
@@ -1694,12 +1694,15 @@ GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
* \returns \c Success on success. \c GLX_BAD_CONTEXT if \c ctx is invalid,
* or zero if the request failed due to internal problems (i.e.,
* unable to allocate temporary memory, etc.)
+ *
+ * \note
+ * This function dynamically determines whether to use the EXT_import_context
+ * version of the protocol or the GLX 1.3 version of the protocol.
*/
static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
{
- xGLXVendorPrivateReq *vpreq;
- xGLXQueryContextInfoEXTReq *req;
- xGLXQueryContextInfoEXTReply reply;
+ __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+ xGLXQueryContextReply reply;
CARD8 opcode;
GLuint numValues;
int retval;
@@ -1714,13 +1717,28 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
/* Send the glXQueryContextInfoEXT request */
LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXQueryContextInfoEXTReq-sz_xGLXVendorPrivateReq,vpreq);
- req = (xGLXQueryContextInfoEXTReq *)vpreq;
- req->reqType = opcode;
- req->glxCode = X_GLXVendorPrivateWithReply;
- req->vendorCode = X_GLXvop_QueryContextInfoEXT;
- req->context = (unsigned int)(ctx->xid);
+
+ if ( (priv->majorVersion > 1) || (priv->minorVersion >= 3) ) {
+ xGLXQueryContextReq * req;
+
+ req->reqType = opcode;
+ req->glxCode = X_GLXQueryContext;
+ req->context = (unsigned int)(ctx->xid);
+ }
+ else {
+ xGLXVendorPrivateReq *vpreq;
+ xGLXQueryContextInfoEXTReq *req;
+
+ GetReqExtra( GLXVendorPrivate,
+ sz_xGLXQueryContextInfoEXTReq - sz_xGLXVendorPrivateReq,
+ vpreq );
+ req = (xGLXQueryContextInfoEXTReq *)vpreq;
+ req->reqType = opcode;
+ req->glxCode = X_GLXVendorPrivateWithReply;
+ req->vendorCode = X_GLXvop_QueryContextInfoEXT;
+ req->context = (unsigned int)(ctx->xid);
+ }
+
_XReply(dpy, (xReply*) &reply, 0, False);
numValues = reply.n;
@@ -1749,12 +1767,15 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
case GLX_VISUAL_ID_EXT:
ctx->vid = *pProp++;
break;
- case GLX_SCREEN_EXT:
+ case GLX_SCREEN:
ctx->screen = *pProp++;
break;
- case GLX_FBCONFIG_ID_SGIX:
+ case GLX_FBCONFIG_ID:
ctx->fbconfigID = *pProp++;
break;
+ case GLX_RENDER_TYPE:
+ ctx->renderType = *pProp++;
+ break;
default:
pProp++;
continue;
@@ -1769,8 +1790,9 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
return retval;
}
-int GLX_PREFIX(glXQueryContextInfoEXT)(Display *dpy, GLXContext ctx,
- int attribute, int *value)
+int
+GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx,
+ int attribute, int *value)
{
int retVal;
@@ -1786,18 +1808,26 @@ int GLX_PREFIX(glXQueryContextInfoEXT)(Display *dpy, GLXContext ctx,
case GLX_VISUAL_ID_EXT:
*value = (int)(ctx->vid);
break;
- case GLX_SCREEN_EXT:
+ case GLX_SCREEN:
*value = (int)(ctx->screen);
break;
- case GLX_FBCONFIG_ID_SGIX:
+ case GLX_FBCONFIG_ID:
*value = (int)(ctx->fbconfigID);
break;
+ case GLX_RENDER_TYPE:
+ *value = (int)(ctx->renderType);
+ break;
default:
return GLX_BAD_ATTRIBUTE;
}
return Success;
}
+GLX_ALIAS( int, glXQueryContextInfoEXT,
+ (Display *dpy, GLXContext ctx, int attribute, int *value),
+ (dpy, ctx, attribute, value),
+ glXQueryContext )
+
GLXContextID glXGetContextIDEXT(const GLXContext ctx)
{
return ctx->xid;
@@ -1934,16 +1964,6 @@ XVisualInfo *GLX_PREFIX(glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig conf
}
-int GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value)
-{
- (void) dpy;
- (void) ctx;
- (void) attribute;
- (void) value;
- return 0;
-}
-
-
/*
** GLX_SGI_make_current_read
*/
@@ -2971,7 +2991,7 @@ static const struct name_address_pair GLX_functions[] = {
GLX_FUNCTION( glXGetContextIDEXT ),
GLX_FUNCTION2( glXGetCurrentDisplayEXT, glXGetCurrentDisplay ),
GLX_FUNCTION( glXImportContextEXT ),
- GLX_FUNCTION( glXQueryContextInfoEXT ),
+ GLX_FUNCTION2( glXQueryContextInfoEXT, glXQueryContext ),
/*** GLX_SGIX_fbconfig ***/
GLX_FUNCTION2( glXGetFBConfigAttribSGIX, glXGetFBConfigAttrib ),