From c491e585e43d48a2aeec96ccc4008da6c443fb42 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 15:33:09 -0400 Subject: glx: Move bind and unbind to context vtable --- src/glx/dri_common.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/glx/dri_common.c') diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 812fb2eb080..a7fb4c64244 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -353,4 +353,31 @@ driDestroyConfigs(const __DRIconfig **configs) free(configs); } +_X_HIDDEN __GLXDRIdrawable * +driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) +{ + struct glx_display *const priv = __glXInitialize(gc->psc->dpy); + __GLXDRIdrawable *pdraw; + struct glx_screen *psc; + + if (priv == NULL) + return NULL; + + psc = priv->screens[gc->screen]; + if (priv->drawHash == NULL) + return NULL; + + if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0) + return pdraw; + + pdraw = psc->driScreen->createDrawable(psc, glxDrawable, + glxDrawable, gc->config); + if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) { + (*pdraw->destroyDrawable) (pdraw); + return NULL; + } + + return pdraw; +} + #endif /* GLX_DIRECT_RENDERING */ -- cgit v1.2.3