From 9a0129a0e4c99a618d775108622b8f19cd381a9d Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Fri, 23 May 2014 10:59:05 +1000 Subject: [PATCH] gl/memory: RGBA/UNSIGNED_BYTE only format supported by ReadPixels GLES2 Error out in case we attempt to read with any other invalid format. --- gst-libs/gst/gl/gstglmemory.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index fedd28f8e8..a5c60d7405 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -758,6 +758,14 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data) goto fbo_error; } + if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2 + && (in_gl_format != GL_RGBA || in_gl_type != GL_UNSIGNED_BYTE)) { + gst_gl_context_set_error (context, "Cannot copy non RGBA/UNSIGNED_BYTE " + "textures on GLES2"); + gl->BindTexture (GL_TEXTURE_2D, 0); + goto fbo_error; + } + if (!src->pbo) gl->GenBuffers (1, &src->pbo);