gl: do not allocate the target texture of an EGLImage
authorJulien Isorce <julien.isorce@collabora.co.uk>
Tue, 6 May 2014 10:59:24 +0000 (11:59 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:39 +0000 (19:31 +0000)
The target texture of an EGLImage is the texture bind just
before calling glEGLImageTargetTexture2D.

As we currently only support a gl texture as the source of an EGLImage
the gl texture is actually already allocated when creating the eglimage.

I also see some cases where it fails to upload an eglimage when
glTexImage2D is called on the target.

gst-libs/gst/gl/gstglupload.c

index 05af11c..23c6916 100644 (file)
 #include "gl.h"
 #include "gstglupload.h"
 
+#if GST_GL_HAVE_PLATFORM_EGL
+#include "egl/gsteglimagememory.h"
+#endif
+
 /**
  * SECTION:gstglupload
  * @short_description: an object that uploads to GL textures
@@ -256,6 +260,12 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
     return TRUE;
   }
 
+#if GST_GL_HAVE_PLATFORM_EGL
+  if (!upload->priv->tex_id && gst_is_egl_image_memory (mem))
+    gst_gl_context_gen_texture (upload->context, &upload->priv->tex_id,
+          GST_VIDEO_FORMAT_RGBA, 0, 0);
+#endif
+
   if (!upload->priv->tex_id)
     gst_gl_context_gen_texture (upload->context, &upload->priv->tex_id,
         GST_VIDEO_FORMAT_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),