Call the GLX/Pixmap related functions through the vtable.

This commit is contained in:
gb 2010-07-01 11:38:28 +00:00 committed by Gwenole Beauchesne
parent fcb65d60f5
commit 982a06b1c7
2 changed files with 26 additions and 2 deletions

View file

@ -664,6 +664,14 @@ gl_init_vtable(void)
gboolean has_extension; gboolean has_extension;
/* GLX_EXT_texture_from_pixmap */ /* GLX_EXT_texture_from_pixmap */
gl_vtable->glx_create_pixmap = (PFNGLXCREATEPIXMAPPROC)
get_proc_address("glXCreatePixmap");
if (!gl_vtable->glx_create_pixmap)
return NULL;
gl_vtable->glx_destroy_pixmap = (PFNGLXDESTROYPIXMAPPROC)
get_proc_address("glXDestroyPixmap");
if (!gl_vtable->glx_destroy_pixmap)
return NULL;
gl_vtable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC) gl_vtable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC)
get_proc_address("glXBindTexImageEXT"); get_proc_address("glXBindTexImageEXT");
if (!gl_vtable->glx_bind_tex_image) if (!gl_vtable->glx_bind_tex_image)
@ -906,7 +914,12 @@ gl_create_pixmap_object(Display *dpy, guint width, guint height)
*attr++ = GL_NONE; *attr++ = GL_NONE;
x11_trap_errors(); x11_trap_errors();
pixo->glx_pixmap = glXCreatePixmap(dpy, fbconfig[0], pixo->pixmap, pixmap_attrs); pixo->glx_pixmap = gl_vtable->glx_create_pixmap(
dpy,
fbconfig[0],
pixo->pixmap,
pixmap_attrs
);
free(fbconfig); free(fbconfig);
if (x11_untrap_errors() != 0) if (x11_untrap_errors() != 0)
goto error; goto error;
@ -934,6 +947,8 @@ error:
void void
gl_destroy_pixmap_object(GLPixmapObject *pixo) gl_destroy_pixmap_object(GLPixmapObject *pixo)
{ {
GLVTable * const gl_vtable = gl_get_vtable();
if (!pixo) if (!pixo)
return; return;
@ -945,7 +960,7 @@ gl_destroy_pixmap_object(GLPixmapObject *pixo)
} }
if (pixo->glx_pixmap) { if (pixo->glx_pixmap) {
glXDestroyPixmap(pixo->dpy, pixo->glx_pixmap); gl_vtable->glx_destroy_pixmap(pixo->dpy, pixo->glx_pixmap);
pixo->glx_pixmap = None; pixo->glx_pixmap = None;
} }

View file

@ -34,6 +34,13 @@ typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int); typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
#endif #endif
#if GLX_GLXEXT_VERSION < 27
/* XXX: this is not exactly that version but this is the only means to
make sure we have the correct <GL/glx.h> with those signatures */
typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
#endif
#ifndef GL_FRAMEBUFFER_BINDING #ifndef GL_FRAMEBUFFER_BINDING
#define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT #define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
#endif #endif
@ -117,6 +124,8 @@ gl_create_texture(GLenum target, GLenum format, guint width, guint height)
typedef struct _GLVTable GLVTable; typedef struct _GLVTable GLVTable;
struct _GLVTable { struct _GLVTable {
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image; PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image; PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers; PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;