gl: Only unbind buffers/vertex attrib arrays if we can't directly bind the vertex array to 0

Binding the vertex array to 0 will unbind everything else already.

In the previous order older versions of the Intel GL driver caused
errors to be printed for every single call when disabling the vertex
attrib arrays after binding the vertex array to 0.
This commit is contained in:
Sebastian Dröge 2019-01-16 14:09:18 +02:00
parent 30b5d7892a
commit acc098a736
12 changed files with 30 additions and 18 deletions

View file

@ -1005,6 +1005,7 @@ gst_ca_opengl_layer_sink_on_draw (GstCAOpenGLLayerSink * ca_sink)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (ca_sink); _unbind_buffer (ca_sink);
/* end default opengl scene */ /* end default opengl scene */

View file

@ -222,6 +222,7 @@ _src_shader_fill_bound_fbo (gpointer impl)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (src); _unbind_buffer (src);
gst_gl_context_clear_shader (src->base.context); gst_gl_context_clear_shader (src->base.context);

View file

@ -484,6 +484,7 @@ _callback (gpointer stuff)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (cube_filter); _unbind_buffer (cube_filter);
gl->Disable (GL_DEPTH_TEST); gl->Disable (GL_DEPTH_TEST);

View file

@ -2299,6 +2299,7 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (gl_sink); _unbind_buffer (gl_sink);
if (gl_sink->ignore_alpha) if (gl_sink->ignore_alpha)

View file

@ -545,6 +545,7 @@ gst_gl_overlay_callback (GstGLFilter * filter, GstGLMemory * in_tex,
out: out:
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (overlay); _unbind_buffer (overlay);
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context); gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);

View file

@ -961,6 +961,7 @@ gst_gl_transformation_callback (gpointer stuff)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (transformation); _unbind_buffer (transformation);
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context); gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);

View file

@ -1613,15 +1613,16 @@ gst_gl_video_mixer_callback (gpointer stuff)
video_mixer->output_geo_change = FALSE; video_mixer->output_geo_change = FALSE;
GST_OBJECT_UNLOCK (video_mixer); GST_OBJECT_UNLOCK (video_mixer);
if (gl->GenVertexArrays) {
gl->BindVertexArray (0);
} else {
gl->DisableVertexAttribArray (attr_position_loc); gl->DisableVertexAttribArray (attr_position_loc);
gl->DisableVertexAttribArray (attr_texture_loc); gl->DisableVertexAttribArray (attr_texture_loc);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
gl->BindBuffer (GL_ARRAY_BUFFER, 0); gl->BindBuffer (GL_ARRAY_BUFFER, 0);
gl->BindTexture (GL_TEXTURE_2D, 0); gl->BindTexture (GL_TEXTURE_2D, 0);
}
gl->Disable (GL_BLEND); gl->Disable (GL_BLEND);

View file

@ -2589,6 +2589,7 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
if (gl->BindVertexArray) if (gl->BindVertexArray)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (convert); _unbind_buffer (convert);
if (gl->DrawBuffer) if (gl->DrawBuffer)

View file

@ -1251,6 +1251,7 @@ gst_gl_filter_draw_fullscreen_quad (GstGLFilter * filter)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (filter); _unbind_buffer (filter);
} }
} }

View file

@ -1928,6 +1928,7 @@ _do_view_convert_draw (GstGLContext * context, GstGLViewConvert * viewconvert)
if (gl->BindVertexArray) if (gl->BindVertexArray)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (viewconvert); _unbind_buffer (viewconvert);
if (gl->DrawBuffer) if (gl->DrawBuffer)
gl->DrawBuffer (GL_COLOR_ATTACHMENT0); gl->DrawBuffer (GL_COLOR_ATTACHMENT0);

View file

@ -246,6 +246,7 @@ blit_tex (gpointer data)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (context); _unbind_buffer (context);
return TRUE; return TRUE;

View file

@ -247,6 +247,7 @@ blit_tex (gpointer data)
if (gl->GenVertexArrays) if (gl->GenVertexArrays)
gl->BindVertexArray (0); gl->BindVertexArray (0);
else
_unbind_buffer (context); _unbind_buffer (context);
return TRUE; return TRUE;