mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
Call the GLX/Pixmap related functions through the vtable.
This commit is contained in:
parent
fcb65d60f5
commit
982a06b1c7
2 changed files with 26 additions and 2 deletions
|
@ -664,6 +664,14 @@ gl_init_vtable(void)
|
|||
gboolean has_extension;
|
||||
|
||||
/* 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)
|
||||
get_proc_address("glXBindTexImageEXT");
|
||||
if (!gl_vtable->glx_bind_tex_image)
|
||||
|
@ -906,7 +914,12 @@ gl_create_pixmap_object(Display *dpy, guint width, guint height)
|
|||
*attr++ = GL_NONE;
|
||||
|
||||
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);
|
||||
if (x11_untrap_errors() != 0)
|
||||
goto error;
|
||||
|
@ -934,6 +947,8 @@ error:
|
|||
void
|
||||
gl_destroy_pixmap_object(GLPixmapObject *pixo)
|
||||
{
|
||||
GLVTable * const gl_vtable = gl_get_vtable();
|
||||
|
||||
if (!pixo)
|
||||
return;
|
||||
|
||||
|
@ -945,7 +960,7 @@ gl_destroy_pixmap_object(GLPixmapObject *pixo)
|
|||
}
|
||||
|
||||
if (pixo->glx_pixmap) {
|
||||
glXDestroyPixmap(pixo->dpy, pixo->glx_pixmap);
|
||||
gl_vtable->glx_destroy_pixmap(pixo->dpy, pixo->glx_pixmap);
|
||||
pixo->glx_pixmap = None;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,13 @@ typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int
|
|||
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
|
||||
#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
|
||||
#define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
|
||||
#endif
|
||||
|
@ -117,6 +124,8 @@ gl_create_texture(GLenum target, GLenum format, guint width, guint height)
|
|||
|
||||
typedef struct _GLVTable GLVTable;
|
||||
struct _GLVTable {
|
||||
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
|
||||
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
|
||||
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
|
||||
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
|
||||
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;
|
||||
|
|
Loading…
Reference in a new issue