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,7 +1005,8 @@ gst_ca_opengl_layer_sink_on_draw (GstCAOpenGLLayerSink * ca_sink)
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
_unbind_buffer (ca_sink);
else
_unbind_buffer (ca_sink);
/* end default opengl scene */
GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1928,7 +1928,8 @@ _do_view_convert_draw (GstGLContext * context, GstGLViewConvert * viewconvert)
if (gl->BindVertexArray)
gl->BindVertexArray (0);
_unbind_buffer (viewconvert);
else
_unbind_buffer (viewconvert);
if (gl->DrawBuffer)
gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
/* we are done with the shader */

View file

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

View file

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