mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
glframebuffer: check frame buffer status need use specific fbo target
https://bugzilla.gnome.org/show_bug.cgi?id=783065
This commit is contained in:
parent
4179109ba2
commit
2fc05e90d8
4 changed files with 15 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue