From 16f568a1830ea17da82683f97e016cdc0aae0c65 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 1 Apr 2010 00:10:28 -0700 Subject: [PATCH] glx: Fix compilation errors on non-GLX_DIRECT_RENDERING builds. driContext field for __GLXcontextRec struct is only defined if GLX_DIRECT_RENDERING is set. --- src/glx/glxcmds.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 49cbce72f8a..8f809dc5259 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -1917,6 +1917,7 @@ __glXSwapIntervalSGI(int interval) #endif psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext && psc->driScreen && psc->driScreen->setSwapInterval) { __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, @@ -1924,6 +1925,7 @@ __glXSwapIntervalSGI(int interval) psc->driScreen->setSwapInterval(pdraw, interval); return 0; } +#endif dpy = gc->currentDpy; opcode = __glXSetupForCommand(dpy); @@ -1974,6 +1976,7 @@ __glXSwapIntervalMESA(unsigned int interval) } #endif +#ifdef GLX_DIRECT_RENDERING if (gc != NULL && gc->driContext) { __GLXscreenConfigs *psc; @@ -1985,6 +1988,7 @@ __glXSwapIntervalMESA(unsigned int interval) return 0; } } +#endif return GLX_BAD_CONTEXT; } @@ -2137,9 +2141,14 @@ __glXGetVideoSyncSGI(unsigned int *count) __GLXscreenConfigs *psc; __GLXDRIdrawable *pdraw; - if (!gc || !gc->driContext) + if (!gc) return GLX_BAD_CONTEXT; +#ifdef GLX_DIRECT_RENDERING + if (!gc->driContext) + return GLX_BAD_CONTEXT; +#endif + psc = GetGLXScreenConfigs(gc->currentDpy, gc->screen); pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); @@ -2177,9 +2186,14 @@ __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) if (divisor <= 0 || remainder < 0) return GLX_BAD_VALUE; - if (!gc || !gc->driContext) + if (!gc) return GLX_BAD_CONTEXT; +#ifdef GLX_DIRECT_RENDERING + if (!gc->driContext) + return GLX_BAD_CONTEXT; +#endif + psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen); pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); @@ -2494,9 +2508,14 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable, __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen); __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen); - if (!pdraw || !gc || !gc->driContext) /* no GLX for this */ + if (!pdraw || !gc) /* no GLX for this */ return -1; +#ifdef GLX_DIRECT_RENDERING + if (!gc->driContext) + return -1; +#endif + /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE * error", but it also says "It [glXSwapBuffersMscOML] will return a value * of -1 if the function failed because of errors detected in the input -- 2.30.2