opengl: reorder renderers initialization
authorRomain Vimont <rom1v@videolabs.io>
Fri, 31 Jan 2020 14:44:25 +0000 (15:44 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 13 Feb 2020 22:11:21 +0000 (23:11 +0100)
Initialize the main renderer, then the sub renderer.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_output/opengl/vout_helper.c

index b7bb6bc..d4a2eda 100644 (file)
@@ -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;
     }