From: Jeremy Huddleston Date: Mon, 24 Oct 2011 23:21:28 +0000 (-0700) Subject: apple: Implement applegl_unbind_context X-Git-Tag: 062012170305~3679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c44c1348ea13f51a1616968daa7034bb48e42b1;p=profile%2Fivi%2Fmesa.git apple: Implement applegl_unbind_context glXMakeCurrent(dpy, None, NULL) would not correctly unbind the context causing subsequent GLX requests to fail in peculiar ways http://xquartz.macosforge.org/trac/ticket/514 Signed-off-by: Jeremy Huddleston --- diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c index 8766c88..9be12b0 100644 --- a/src/glx/applegl_glx.c +++ b/src/glx/applegl_glx.c @@ -69,6 +69,24 @@ applegl_bind_context(struct glx_context *gc, struct glx_context *old, static void applegl_unbind_context(struct glx_context *gc, struct glx_context *new) { + Display *dpy; + bool error; + + /* If we don't have a context, then we have nothing to unbind */ + if (!gc) + return; + + /* If we have a new context, keep this one around and remove it during bind. */ + if (new) + return; + + dpy = gc->psc->dpy; + + error = apple_glx_make_current_context(dpy, + (gc != &dummyContext) ? gc->driContext : NULL, + NULL, None); + + apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO"); } static void