[vlc-devel] [PATCH v2 29/29] opengl: reorder renderers initialization

Romain Vimont rom1v at videolabs.io
Thu Feb 6 14:17:58 CET 2020


Initialize the main renderer, then the sub renderer. Because.
---
 modules/video_output/opengl/vout_helper.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index b7bb6bc363..d4a2eda148 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -240,16 +240,6 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
 
     bool b_dump_shaders = var_InheritInteger(gl, "verbose") >= 4;
 
-    vgl->sub_renderer =
-        vlc_gl_sub_renderer_New(gl, &vgl->vt, supports_npot);
-    if (!vgl->sub_renderer)
-    {
-        msg_Err(gl, "Could not create sub renderer");
-        free(vgl);
-        return NULL;
-    }
-
-    GL_ASSERT_NOERROR();
     struct vlc_gl_renderer *renderer = vgl->renderer =
         vlc_gl_renderer_New(gl, &vgl->vt, context, fmt, supports_npot,
                             b_dump_shaders);
@@ -257,7 +247,18 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     {
         msg_Warn(gl, "Could not create renderer for %4.4s",
                  (const char *) &fmt->i_chroma);
-        vlc_gl_sub_renderer_Delete(vgl->sub_renderer);
+        free(vgl);
+        return NULL;
+    }
+
+    GL_ASSERT_NOERROR();
+
+    vgl->sub_renderer =
+        vlc_gl_sub_renderer_New(gl, &vgl->vt, supports_npot);
+    if (!vgl->sub_renderer)
+    {
+        msg_Err(gl, "Could not create sub renderer");
+        vlc_gl_renderer_Delete(vgl->renderer);
         free(vgl);
         return NULL;
     }
-- 
2.25.0



More information about the vlc-devel mailing list