From 643b2af0203764cb9f0a5b9e082937ab3f243523 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 21 May 2010 10:36:56 -0400 Subject: glx: Split tfp functions out to context vtable This introduces a new per-context vtable, which lets us clean up all the #ifdef's a bit and move the DRI2 specific implementation into dri2_glx.c. --- src/glx/dri2_glx.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/glx/dri2_glx.c') diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 45959915b4b..ba546a6bc1c 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -563,6 +563,40 @@ dri2InvalidateBuffers(Display *dpy, XID drawable) #endif } +static void +dri2_bind_tex_image(Display * dpy, + GLXDrawable drawable, + int buffer, const int *attrib_list) +{ + GLXContext gc = __glXGetCurrentContext(); + __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); + + if (pdraw != NULL) { + if (pdraw->psc->texBuffer->base.version >= 2 && + pdraw->psc->texBuffer->setTexBuffer2 != NULL) { + (*pdraw->psc->texBuffer->setTexBuffer2) (gc->__driContext, + pdraw->textureTarget, + pdraw->textureFormat, + pdraw->driDrawable); + } + else { + (*pdraw->psc->texBuffer->setTexBuffer) (gc->__driContext, + pdraw->textureTarget, + pdraw->driDrawable); + } + } +} + +static void +dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer) +{ +} + +static const struct glx_context_vtable dri2_context_vtable = { + dri2_bind_tex_image, + dri2_release_tex_image, +}; + static __GLXDRIscreen * dri2CreateScreen(__GLXscreenConfigs * psc, int screen, __GLXdisplayPrivate * priv) @@ -683,6 +717,8 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen, psp->copySubBuffer = dri2CopySubBuffer; __glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer"); + psc->direct_context_vtable = &dri2_context_vtable; + Xfree(driverName); Xfree(deviceName); -- cgit v1.2.3