From 2b4e009ed56b69b243f5cc88f490dcf8166cf729 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Feb 2010 15:39:36 -0800 Subject: glx: Use wrapper macro to detect direct rendering The wrapper macro GC_IS_DIRECT is used in CreateContext and a couple other places to eliminate the need for some of the '#ifdef GLX_DIRECT_RENDERING' madness. There appear to be a *LOT* of places in glxcmds.c where '#ifdef GLX_DIRECT_RENDERING' is missing. --- src/glx/glxcmds.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index c3be974ea91..49224060adb 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -42,6 +42,9 @@ #include #include #include "xf86dri.h" +#define GC_IS_DIRECT(gc) ((gc)->driContext != NULL) +#else +#define GC_IS_DIRECT(gc) (0) #endif #if defined(USE_XCB) @@ -431,11 +434,7 @@ CreateContext(Display * dpy, XVisualInfo * vis, req->visual = vis->visualid; req->screen = vis->screen; req->shareList = shareList ? shareList->xid : None; -#ifdef GLX_DIRECT_RENDERING - req->isDirect = gc->driContext != NULL; -#else - req->isDirect = 0; -#endif + req->isDirect = GC_IS_DIRECT(gc); } else if (use_glx_1_3) { xGLXCreateNewContextReq *req; @@ -449,11 +448,7 @@ CreateContext(Display * dpy, XVisualInfo * vis, req->screen = fbconfig->screen; req->renderType = renderType; req->shareList = shareList ? shareList->xid : None; -#ifdef GLX_DIRECT_RENDERING - req->isDirect = gc->driContext != NULL; -#else - req->isDirect = 0; -#endif + req->isDirect = GC_IS_DIRECT(gc); } else { xGLXVendorPrivateWithReplyReq *vpreq; @@ -472,11 +467,7 @@ CreateContext(Display * dpy, XVisualInfo * vis, req->screen = fbconfig->screen; req->renderType = renderType; req->shareList = shareList ? shareList->xid : None; -#ifdef GLX_DIRECT_RENDERING - req->isDirect = gc->driContext != NULL; -#else - req->isDirect = 0; -#endif + req->isDirect = GC_IS_DIRECT(gc); } UnlockDisplay(dpy); @@ -864,11 +855,9 @@ glXIsDirect(Display * dpy, GLXContext gc) { if (!gc) { return GL_FALSE; -#ifdef GLX_DIRECT_RENDERING } - else if (gc->driContext) { + else if (GC_IS_DIRECT(gc)) { return GL_TRUE; -#endif } return __glXIsDirect(dpy, gc->xid); } @@ -2874,13 +2863,8 @@ __glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer) INT32 *buffer_ptr; CARD8 opcode; - if (gc == NULL) - return; - -#ifdef GLX_DIRECT_RENDERING - if (gc->driContext) + if ((gc == NULL) || GC_IS_DIRECT(gc)) return; -#endif opcode = __glXSetupForCommand(dpy); if (!opcode) -- cgit v1.2.3