diff options
Diffstat (limited to 'src/glx/glxcmds.c')
-rw-r--r-- | src/glx/glxcmds.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 4f7e84ef5f9..22bebab26bc 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -36,6 +36,7 @@ #include "glxclient.h" #include "glapi.h" #include "glxextensions.h" +#include "indirect.h" #ifdef GLX_DIRECT_RENDERING #ifdef GLX_USE_APPLEGL @@ -214,12 +215,16 @@ CreateContext(Display * dpy, int generic_id, Bool allowDirect, unsigned code, int renderType, int screen) { - struct glx_context *gc = NULL; - struct glx_screen *const psc = GetGLXScreenConfigs(dpy, screen); + struct glx_context *gc; + struct glx_screen *psc; struct glx_context *shareList = (struct glx_context *) shareList_user; if (dpy == NULL) return NULL; + psc = GetGLXScreenConfigs(dpy, screen); + if (psc == NULL) + return NULL; + if (generic_id == None) return NULL; @@ -722,11 +727,16 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) xGLXSwapBuffersReq *req; #endif + gc = __glXGetCurrentContext(); + #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); if (pdraw != NULL) { - glFlush(); + if (gc && drawable == gc->currentDrawable) { + glFlush(); + } + (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0); return; } @@ -741,7 +751,6 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) ** The calling thread may or may not have a current context. If it ** does, send the context tag so the server can do a flush. */ - gc = __glXGetCurrentContext(); if ((gc != NULL) && (dpy == gc->currentDpy) && ((drawable == gc->currentDrawable) || (drawable == gc->currentReadable))) { @@ -2514,7 +2523,11 @@ _X_EXPORT void (*glXGetProcAddressARB(const GLubyte * procName)) (void) f = (gl_function) get_glx_proc_address((const char *) procName); if ((f == NULL) && (procName[0] == 'g') && (procName[1] == 'l') && (procName[2] != 'X')) { - f = (gl_function) _glapi_get_proc_address((const char *) procName); +#ifdef GLX_SHARED_GLAPI + f = (gl_function) __indirect_get_proc_address((const char *) procName); +#endif + if (!f) + f = (gl_function) _glapi_get_proc_address((const char *) procName); } #endif return f; |