diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c index 5af46cf..6a40c5f 100644 --- a/src/glx/x11/glxcurrent.c +++ b/src/glx/x11/glxcurrent.c @@ -330,9 +330,10 @@ FetchDRIDrawable(Display * dpy, if (__glxHashLookup(psc->drawHash, glxDrawable, (void *) &pdraw) == 0) return pdraw; - /* If this is glXMakeCurrent (pre GLX 1.3) we allow creating the - * GLX drawable on the fly. Otherwise we pass None as the X - * drawable */ + /* If this is glXMakeCurrent or glXMakeCurrentReadSGI (i.e., any of the + * pre GLX 1.3 functions) we allow creating the GLX drawable on the fly. + * Otherwise we pass None as the X drawable. + */ if (pre13) drawable = glxDrawable; else @@ -387,6 +388,19 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc, pre13); __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc, pre13); + if ((pdraw == NULL) || (pread == NULL)) { + xError error; + + error.errorCode = GLXBadDrawable; + error.resourceID = (pdraw == NULL) ? draw : read; + error.sequenceNumber = dpy->request; + error.type = X_Error; + error.majorCode = gc->majorOpcode; + error.minorCode = X_GLXMakeContextCurrent; + _XError(dpy, &error); + return False; + } + bindReturnValue = (gc->driContext->bindContext) (gc->driContext, pdraw, pread); } @@ -519,12 +533,16 @@ glXMakeCurrent(Display * dpy, GLXDrawable draw, GLXContext gc) return MakeContextCurrent(dpy, draw, draw, gc, True); } -PUBLIC -GLX_ALIAS(Bool, glXMakeCurrentReadSGI, - (Display * dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx), - (dpy, d, r, ctx, False), MakeContextCurrent) +PUBLIC Bool +glXMakeCurrentReadSGI(Display * dpy, GLXDrawable d, GLXDrawable r, + GLXContext gc) +{ + return MakeContextCurrent(dpy, d, r, gc, True); +} - PUBLIC GLX_ALIAS(Bool, glXMakeContextCurrent, - (Display * dpy, GLXDrawable d, GLXDrawable r, - GLXContext ctx), (dpy, d, r, ctx, False), - MakeContextCurrent) +PUBLIC Bool +glXMakeContextCurrent(Display * dpy, GLXDrawable d, GLXDrawable r, + GLXContext gc) +{ + return MakeContextCurrent(dpy, d, r, gc, False); +}