summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoridr <idr>2004-06-09 17:45:31 +0000
committeridr <idr>2004-06-09 17:45:31 +0000
commit18645b89fd125fbaefbd3b290eb88cea49db858e (patch)
tree98bcd924ba13f4570796c70f36dff777424d25e1
parentd39737e5f4ebc582167f529526ae842dce829bbf (diff)
Add support for glXQueryContext (part of GLX 1.3).
-rw-r--r--xc/lib/GL/glx/glxclient.h7
-rw-r--r--xc/lib/GL/glx/glxcmds.c74
2 files changed, 53 insertions, 28 deletions
diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h
index 45bffd8cb..0134c3a39 100644
--- a/xc/lib/GL/glx/glxclient.h
+++ b/xc/lib/GL/glx/glxclient.h
@@ -67,7 +67,7 @@
#endif
#define GLX_MAJOR_VERSION 1 /* current version numbers */
-#define GLX_MINOR_VERSION 2
+#define GLX_MINOR_VERSION 4
#define __GLX_MAX_TEXTURE_UNITS 32
@@ -529,6 +529,11 @@ struct __GLXcontextRec {
* drivers should NEVER use this data or even care that it exists.
*/
void * client_state_private;
+
+ /**
+ * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
+ */
+ int renderType;
};
#define __glXSetError(gc,code) \
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 ),