gl: GL_ARRAY_BUFFER is not a part of VAO state

As a result we need to bind it on every draw in order to have the
correct state in the GL state machine.
This commit is contained in:
Matthew Waters 2017-03-14 14:15:00 +11:00
parent b01ae6e5e6
commit efc015f27d
12 changed files with 26 additions and 62 deletions

View file

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

View file

@ -213,7 +213,6 @@ _src_shader_fill_bound_fbo (gpointer impl)
if (gl->GenVertexArrays)
gl->BindVertexArray (src->vao);
else
_bind_buffer (src);
gl->DrawElements (GL_TRIANGLES, src->n_indices, GL_UNSIGNED_SHORT,
@ -221,7 +220,6 @@ _src_shader_fill_bound_fbo (gpointer impl)
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
else
_unbind_buffer (src);
gst_gl_context_clear_shader (src->base.context);

View file

@ -476,14 +476,12 @@ _callback (gpointer stuff)
if (gl->GenVertexArrays)
gl->BindVertexArray (cube_filter->vao);
else
_bind_buffer (cube_filter);
gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, 0);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
else
_unbind_buffer (cube_filter);
gl->Disable (GL_DEPTH_TEST);

View file

@ -2228,7 +2228,6 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
if (gl->GenVertexArrays)
gl->BindVertexArray (gl_sink->vao);
else
_bind_buffer (gl_sink);
gl->ActiveTexture (GL_TEXTURE0);
@ -2258,7 +2257,6 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
else
_unbind_buffer (gl_sink);
if (gl_sink->ignore_alpha)

View file

@ -522,9 +522,7 @@ gst_gl_overlay_callback (GstGLFilter * filter, GstGLMemory * in_tex,
GL_STATIC_DRAW);
}
if (!gl->GenVertexArrays || overlay->geometry_change) {
_bind_buffer (overlay, overlay->overlay_vbo);
}
gl->BindTexture (GL_TEXTURE_2D, image_tex);
gst_gl_shader_set_uniform_1f (overlay->shader, "alpha", overlay->alpha);
@ -539,11 +537,9 @@ gst_gl_overlay_callback (GstGLFilter * filter, GstGLMemory * in_tex,
ret = TRUE;
out:
if (gl->GenVertexArrays) {
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
} else {
_unbind_buffer (overlay);
}
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);

View file

@ -960,18 +960,14 @@ gst_gl_transformation_callback (gpointer stuff)
if (gl->GenVertexArrays)
gl->BindVertexArray (transformation->vao);
if (transformation->caps_change) {
if (transformation->caps_change)
_upload_vertices (transformation);
_bind_buffer (transformation);
} else if (!gl->GenVertexArrays) {
_bind_buffer (transformation);
}
gl->DrawElements (GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, 0);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
else
_unbind_buffer (transformation);
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);

View file

@ -191,7 +191,6 @@ _redraw_texture (GtkGstGLWidget * gst_widget, guint tex)
if (gl->BindVertexArray)
gl->BindVertexArray (priv->vao);
else
gtk_gst_gl_widget_bind_buffer (gst_widget);
gl->ActiveTexture (GL_TEXTURE0);
@ -202,7 +201,6 @@ _redraw_texture (GtkGstGLWidget * gst_widget, guint tex)
if (gl->BindVertexArray)
gl->BindVertexArray (0);
else
gtk_gst_gl_widget_unbind_buffer (gst_widget);
gl->BindTexture (GL_TEXTURE_2D, 0);

View file

@ -2476,7 +2476,6 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
if (gl->BindVertexArray)
gl->BindVertexArray (convert->priv->vao);
else
_bind_buffer (convert);
for (i = c_info->in_n_textures - 1; i >= 0; i--) {
@ -2501,7 +2500,6 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
if (gl->BindVertexArray)
gl->BindVertexArray (0);
else
_unbind_buffer (convert);
if (gl->DrawBuffer)

View file

@ -1203,26 +1203,16 @@ gst_gl_filter_draw_fullscreen_quad (GstGLFilter * filter)
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, filter->vbo_indices);
gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
GL_STATIC_DRAW);
if (gl->GenVertexArrays) {
_bind_buffer (filter);
gl->BindVertexArray (0);
}
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
}
if (gl->GenVertexArrays)
gl->BindVertexArray (filter->vao);
else
_bind_buffer (filter);
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
else
_unbind_buffer (filter);
}
}

View file

@ -1923,7 +1923,6 @@ _do_view_convert_draw (GstGLContext * context, GstGLViewConvert * viewconvert)
if (gl->BindVertexArray)
gl->BindVertexArray (priv->vao);
else
_bind_buffer (viewconvert);
if (in_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
@ -1944,7 +1943,6 @@ _do_view_convert_draw (GstGLContext * context, GstGLViewConvert * viewconvert)
if (gl->BindVertexArray)
gl->BindVertexArray (0);
else
_unbind_buffer (viewconvert);
if (gl->DrawBuffer)
gl->DrawBuffer (GL_NONE);

View file

@ -239,14 +239,12 @@ blit_tex (gpointer data)
if (gl->GenVertexArrays)
gl->BindVertexArray (vao);
else
_bind_buffer (context);
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
else
_unbind_buffer (context);
return TRUE;

View file

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