[vlc-devel] [PATCH 05/17] opengl: use the interop format in renderer

Romain Vimont rom1v at videolabs.io
Thu Apr 2 14:24:18 CEST 2020


The interop initializes its own video_format_t from the input format.

In the renderer initialization, always use this updated format. This
avoids an additional format parameter, which may be confusing.
---
 modules/video_output/opengl/renderer.c    | 10 +++++-----
 modules/video_output/opengl/renderer.h    |  4 +---
 modules/video_output/opengl/vout_helper.c |  2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index ded06dd500..a588b57c33 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -432,10 +432,10 @@ static int SetupCoords(struct vlc_gl_renderer *renderer);
 
 struct vlc_gl_renderer *
 vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
-                    struct vlc_gl_interop *interop,
-                    const video_format_t *fmt, bool b_dump_shaders)
+                    struct vlc_gl_interop *interop, bool b_dump_shaders)
 {
     const opengl_vtable_t *vt = &api->vt;
+    const video_format_t *fmt = &interop->fmt;
 
     struct vlc_gl_sampler *sampler = calloc(1, sizeof(*sampler));
     if (!sampler)
@@ -484,11 +484,11 @@ vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
         return NULL;
     }
 
-    InitStereoMatrix(renderer->var.StereoMatrix, interop->fmt.multiview_mode);
+    InitStereoMatrix(renderer->var.StereoMatrix, fmt->multiview_mode);
 
-    getOrientationTransformMatrix(interop->fmt.orientation,
+    getOrientationTransformMatrix(fmt->orientation,
                                   sampler->var.OrientationMatrix);
-    getViewpointMatrixes(renderer, interop->fmt.projection_mode);
+    getViewpointMatrixes(renderer, fmt->projection_mode);
 
     renderer->fmt = *fmt;
 
diff --git a/modules/video_output/opengl/renderer.h b/modules/video_output/opengl/renderer.h
index 9c426ccbaf..5150834603 100644
--- a/modules/video_output/opengl/renderer.h
+++ b/modules/video_output/opengl/renderer.h
@@ -131,13 +131,11 @@ struct vlc_gl_renderer
  * \param gl the GL context
  * \param api the OpenGL API
  * \param interop the interop
- * \param fmt the video format
  * \param dump_shaders indicate if the shaders must be dumped in logs
  */
 struct vlc_gl_renderer *
 vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
-                    struct vlc_gl_interop *interop, const video_format_t *fmt,
-                    bool dump_shaders);
+                    struct vlc_gl_interop *interop, bool dump_shaders);
 
 /**
  * Delete a renderer
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index fa649c3b94..c34cf20dc0 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -144,7 +144,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
 
     vgl->renderer =
-        vlc_gl_renderer_New(gl, &vgl->api, vgl->interop, fmt, b_dump_shaders);
+        vlc_gl_renderer_New(gl, &vgl->api, vgl->interop, b_dump_shaders);
     if (!vgl->renderer)
     {
         msg_Warn(gl, "Could not create renderer for %4.4s",
-- 
2.26.0



More information about the vlc-devel mailing list