summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-12-14 18:20:23 +1100
committerMatthew Waters <matthew@centricular.com>2015-12-14 18:22:58 +1100
commit41c3cb30d4aa19fab15f5e46f85a2ff50939e729 (patch)
tree750aada1d52f8662c1c1bc5d614e25791c00da9a /gst-libs
parent5d0d2ec6ca9e66e853fc4a419a8b64a28333f1cb (diff)
downloadgstreamer-plugins-bad-41c3cb30d4aa19fab15f5e46f85a2ff50939e729.tar.gz
glbuffer: bind/unbind on map/unmap for GL mappings
Bind the handle to the GL target on map/unmap to save the caller from handling this themselves.
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/gl/gstglbuffer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gst-libs/gst/gl/gstglbuffer.c b/gst-libs/gst/gl/gstglbuffer.c
index 32305c52b..5d8db2ede 100644
--- a/gst-libs/gst/gl/gstglbuffer.c
+++ b/gst-libs/gst/gl/gstglbuffer.c
@@ -201,10 +201,13 @@ gst_gl_buffer_upload_cpu_write (GstGLBuffer * mem, GstMapInfo * info,
static gpointer
_gl_buffer_map (GstGLBuffer * mem, GstMapInfo * info, gsize size)
{
+ const GstGLFuncs *gl = mem->mem.context->gl_vtable;
+
if ((info->flags & GST_MAP_GL) != 0) {
if (info->flags & GST_MAP_READ) {
gst_gl_buffer_upload_cpu_write (mem, info, size);
}
+ gl->BindBuffer (mem->target, mem->id);
return &mem->id;
} else {
return gst_gl_buffer_cpu_access (mem, info, size);
@@ -216,6 +219,11 @@ _gl_buffer_map (GstGLBuffer * mem, GstMapInfo * info, gsize size)
static void
_gl_buffer_unmap (GstGLBuffer * mem, GstMapInfo * info)
{
+ const GstGLFuncs *gl = mem->mem.context->gl_vtable;
+
+ if ((info->flags & GST_MAP_GL) != 0) {
+ gl->BindBuffer (mem->target, 0);
+ }
/* XXX: optimistically transfer data */
}