mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-05 09:00:54 +00:00
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.
This commit is contained in:
parent
5d0d2ec6ca
commit
41c3cb30d4
1 changed files with 8 additions and 0 deletions
|
@ -201,10 +201,13 @@ gst_gl_buffer_upload_cpu_write (GstGLBuffer * mem, GstMapInfo * info,
|
||||||
static gpointer
|
static gpointer
|
||||||
_gl_buffer_map (GstGLBuffer * mem, GstMapInfo * info, gsize size)
|
_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_GL) != 0) {
|
||||||
if (info->flags & GST_MAP_READ) {
|
if (info->flags & GST_MAP_READ) {
|
||||||
gst_gl_buffer_upload_cpu_write (mem, info, size);
|
gst_gl_buffer_upload_cpu_write (mem, info, size);
|
||||||
}
|
}
|
||||||
|
gl->BindBuffer (mem->target, mem->id);
|
||||||
return &mem->id;
|
return &mem->id;
|
||||||
} else {
|
} else {
|
||||||
return gst_gl_buffer_cpu_access (mem, info, size);
|
return gst_gl_buffer_cpu_access (mem, info, size);
|
||||||
|
@ -216,6 +219,11 @@ _gl_buffer_map (GstGLBuffer * mem, GstMapInfo * info, gsize size)
|
||||||
static void
|
static void
|
||||||
_gl_buffer_unmap (GstGLBuffer * mem, GstMapInfo * info)
|
_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 */
|
/* XXX: optimistically transfer data */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue