[vlc-commits] opengl: move renderer clean up to DeleteRenderer()

Romain Vimont git at videolan.org
Thu Feb 13 23:13:12 CET 2020


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Jan 27 15:13:19 2020 +0100| [47a6eecc05fbc5b6ef958434ca365b428ed4e892] | committer: Jean-Baptiste Kempf

opengl: move renderer clean up to DeleteRenderer()

Some renderer clean up was done after the call to DeleteRenderer().
Move it to DeleteRenderer to simplify further refactorings.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47a6eecc05fbc5b6ef958434ca365b428ed4e892
---

 modules/video_output/opengl/vout_helper.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index a161c4b2aa..98be8f9a78 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -359,7 +359,18 @@ error:
 static void
 DeleteRenderer(struct vlc_gl_renderer *renderer)
 {
-    vlc_gl_interop_Delete(renderer->interop);
+    const opengl_vtable_t *vt = renderer->vt;
+    struct vlc_gl_interop *interop = renderer->interop;
+
+    vt->DeleteBuffers(1, &renderer->vertex_buffer_object);
+    vt->DeleteBuffers(1, &renderer->index_buffer_object);
+    vt->DeleteBuffers(interop->tex_count, renderer->texture_buffer_object);
+
+    if (!interop->handle_texs_gen)
+        vt->DeleteTextures(interop->tex_count, renderer->textures);
+
+    vlc_gl_interop_Delete(interop);
+
     if (renderer->program_id != 0)
         renderer->vt->DeleteProgram(renderer->program_id);
 
@@ -703,21 +714,9 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
     vgl->vt.Finish();
     vgl->vt.Flush();
 
-    struct vlc_gl_renderer *renderer = vgl->renderer;
-    const struct vlc_gl_interop *interop = renderer->interop;
-    const size_t main_tex_count = interop->tex_count;
-    const bool main_del_texs = !interop->handle_texs_gen;
-
     vlc_gl_sub_renderer_Delete(vgl->sub_renderer);
     DeleteRenderer(vgl->renderer);
 
-    vgl->vt.DeleteBuffers(1, &renderer->vertex_buffer_object);
-    vgl->vt.DeleteBuffers(1, &renderer->index_buffer_object);
-    vgl->vt.DeleteBuffers(main_tex_count, renderer->texture_buffer_object);
-
-    if (main_del_texs)
-        vgl->vt.DeleteTextures(main_tex_count, renderer->textures);
-
     GL_ASSERT_NOERROR();
 
     free(vgl);



More information about the vlc-commits mailing list