diff options
author | Kristian Høgsberg <[email protected]> | 2010-05-21 10:36:56 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2010-05-21 23:24:37 -0400 |
commit | 643b2af0203764cb9f0a5b9e082937ab3f243523 (patch) | |
tree | 685afc7329526395fd7865017d05893c9bd3396d /src/glx/dri2_glx.c | |
parent | 4db0c760195c67f1bc114fdfb8464791030a526c (diff) |
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.
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r-- | src/glx/dri2_glx.c | 36 |
1 files changed, 36 insertions, 0 deletions
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); |