[vlc-devel] [PATCH 05/24] opengl: simplify opengl_init_program() call

Romain Vimont rom1v at videolabs.io
Mon Jan 27 21:19:55 CET 2020


Do not pass extensions to opengl_init_program().

This was an optimization not to retrieve the extensions list twice.
However, since the initialization will be moved into a separate
component (the renderer), we don't want to expose this internal detail.
---
 modules/video_output/opengl/vout_helper.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 7e472f7b62..21d7914d6b 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -535,10 +535,17 @@ opengl_deinit_program(vout_display_opengl_t *vgl, struct prgm *prgm)
 
 static int
 opengl_init_program(vout_display_opengl_t *vgl, vlc_video_context *context,
-                    struct prgm *prgm, const char *glexts,
-                    const video_format_t *fmt, bool subpics,
+                    struct prgm *prgm, const video_format_t *fmt, bool subpics,
                     bool b_dump_shaders)
 {
+    const char *glexts = (const char *) vgl->vt.GetString(GL_EXTENSIONS);
+    assert(glexts);
+    if (!glexts)
+    {
+        msg_Err(vgl->gl, "glGetString returned NULL");
+        return VLC_EGENERIC;
+    }
+
     opengl_tex_converter_t *tc = calloc(1, sizeof(*tc));
     if (tc == NULL)
         return VLC_ENOMEM;
@@ -840,7 +847,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
 
     GL_ASSERT_NOERROR();
     int ret;
-    ret = opengl_init_program(vgl, context, vgl->prgm, extensions, fmt, false,
+    ret = opengl_init_program(vgl, context, vgl->prgm, fmt, false,
                               b_dump_shaders);
     if (ret != VLC_SUCCESS)
     {
@@ -851,7 +858,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
 
     GL_ASSERT_NOERROR();
-    ret = opengl_init_program(vgl, context, vgl->sub_prgm, extensions, fmt, true,
+    ret = opengl_init_program(vgl, context, vgl->sub_prgm, fmt, true,
                               b_dump_shaders);
     if (ret != VLC_SUCCESS)
     {
-- 
2.25.0



More information about the vlc-devel mailing list