Commit acc098a7 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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.
parent 30b5d789
Pipeline #15159 passed with stages
in 18 minutes and 41 seconds
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
}
......@@ -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 */
......
......@@ -246,7 +246,8 @@ blit_tex (gpointer data)
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
_unbind_buffer (context);
else
_unbind_buffer (context);
return TRUE;
}
......
......@@ -247,7 +247,8 @@ blit_tex (gpointer data)
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
_unbind_buffer (context);
else
_unbind_buffer (context);
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment