[vlc-devel] [PATCH 18/41] opengl: use the interop format in renderer

Romain Vimont rom1v at videolabs.io
Fri Feb 7 17:42:04 CET 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    | 12 ++++++------
 modules/video_output/opengl/renderer.h    |  4 +---
 modules/video_output/opengl/vout_helper.c |  2 +-
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 7b1cca6a1d..c7f5ccf6d1 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,14 +484,14 @@ 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);
 
     /* Update the fmt to main program one */
-    renderer->fmt = interop->fmt;
+    renderer->fmt = *fmt;
     /* The orientation is handled by the orientation matrix */
     renderer->fmt.orientation = fmt->orientation;
 
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 7ba1a13037..62affc0c16 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -152,7 +152,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
 
     struct vlc_gl_renderer *renderer = 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.25.0



More information about the vlc-devel mailing list