gl/memory: RGBA/UNSIGNED_BYTE only format supported by ReadPixels GLES2
authorMatthew Waters <ystreet00@gmail.com>
Fri, 23 May 2014 00:59:05 +0000 (10:59 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:41 +0000 (19:31 +0000)
Error out in case we attempt to read with any other invalid format.

gst-libs/gst/gl/gstglmemory.c

index fedd28f..a5c60d7 100644 (file)
@@ -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);