diff --git a/ext/qt/qtwindow.cc b/ext/qt/qtwindow.cc index 92c5834c1d..6f1df7edbd 100644 --- a/ext/qt/qtwindow.cc +++ b/ext/qt/qtwindow.cc @@ -217,7 +217,7 @@ QtGLWindow::afterRendering() gl->BindFramebuffer (GL_READ_FRAMEBUFFER, this->source->renderTargetId()); - ret = gst_gl_context_check_framebuffer_status (context); + ret = gst_gl_context_check_framebuffer_status (context, GL_READ_FRAMEBUFFER); if (!ret) { GST_ERROR ("FBO errors"); goto errors; @@ -233,7 +233,7 @@ QtGLWindow::afterRendering() gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_tex, 0); - ret = gst_gl_context_check_framebuffer_status (context); + ret = gst_gl_context_check_framebuffer_status (context, GL_DRAW_FRAMEBUFFER); if (!ret) { GST_ERROR ("FBO errors"); goto errors; diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 60ae5cbd43..40da43e6f8 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -2513,7 +2513,7 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert) gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2], viewport_dim[3]); - if (!gst_gl_context_check_framebuffer_status (context)) + if (!gst_gl_context_check_framebuffer_status (context, GL_FRAMEBUFFER)) ret = FALSE; gst_gl_context_clear_framebuffer (context); diff --git a/gst-libs/gst/gl/gstglframebuffer.c b/gst-libs/gst/gl/gstglframebuffer.c index ef9bf73268..7b522dc847 100644 --- a/gst-libs/gst/gl/gstglframebuffer.c +++ b/gst-libs/gst/gl/gstglframebuffer.c @@ -508,11 +508,17 @@ gst_gl_framebuffer_get_effective_dimensions (GstGLFramebuffer * fb, * Since: 1.10 */ gboolean -gst_gl_context_check_framebuffer_status (GstGLContext * context) +gst_gl_context_check_framebuffer_status (GstGLContext * context, GLenum fbo_target) { g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE); - switch (context->gl_vtable->CheckFramebufferStatus (GL_FRAMEBUFFER)) { + if (fbo_target != GL_FRAMEBUFFER && fbo_target != GL_READ_FRAMEBUFFER + && fbo_target != GL_DRAW_FRAMEBUFFER) { + GST_ERROR_OBJECT (context, "fbo target is invalid"); + return FALSE; + } + + switch (context->gl_vtable->CheckFramebufferStatus (fbo_target)) { case GL_FRAMEBUFFER_COMPLETE: return TRUE; break; diff --git a/gst-libs/gst/gl/gstglframebuffer.h b/gst-libs/gst/gl/gstglframebuffer.h index 297a71ee02..172f999fa0 100644 --- a/gst-libs/gst/gl/gstglframebuffer.h +++ b/gst-libs/gst/gl/gstglframebuffer.h @@ -103,7 +103,8 @@ void gst_gl_framebuffer_get_effective_dimensions (GstGLFrameb guint * height); GST_EXPORT -gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context); +gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context, + GLenum fbo_target); GST_EXPORT gboolean gst_gl_framebuffer_draw_to_texture (GstGLFramebuffer * fb, diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index 2425b3878f..0a06086c62 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -373,7 +373,7 @@ gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer read_pointer) gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gst_gl_texture_target_to_gl (gl_mem->tex_target), gl_mem->tex_id, 0); - if (!gst_gl_context_check_framebuffer_status (context)) { + if (!gst_gl_context_check_framebuffer_status (context, GL_FRAMEBUFFER)) { GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not create framebuffer to read pixels for memory %p", gl_mem); gl->DeleteFramebuffers (1, &fbo); @@ -682,7 +682,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id, gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0); - if (!gst_gl_context_check_framebuffer_status (src->mem.context)) + if (!gst_gl_context_check_framebuffer_status (src->mem.context, GL_FRAMEBUFFER)) goto fbo_error; gl->BindTexture (out_tex_target, tex_id); @@ -711,7 +711,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id, gl->FramebufferTexture2D (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0); - if (!gst_gl_context_check_framebuffer_status (src->mem.context)) + if (!gst_gl_context_check_framebuffer_status (src->mem.context, GL_READ_FRAMEBUFFER)) goto fbo_error; gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]); @@ -719,7 +719,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id, gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gst_gl_texture_target_to_gl (src->tex_target), tex_id, 0); - if (!gst_gl_context_check_framebuffer_status (src->mem.context)) + if (!gst_gl_context_check_framebuffer_status (src->mem.context, GL_DRAW_FRAMEBUFFER)) goto fbo_error; gl->BindTexture (out_tex_target, tex_id);