[vlc-commits] opengl: move "dump shaders" flag to renderer

Romain Vimont git at videolan.org
Mon Jun 15 17:39:03 CEST 2020


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Thu Jun  4 11:52:11 2020 +0200| [18b72e2e19233dc25c92ade2d0ef309c8d98774b] | committer: Alexandre Janniaux

opengl: move "dump shaders" flag to renderer

For now, only the renderer dumps its shaders depending on the verbose
level.

This simplifies vlc_gl_renderer_New(), and paves the way to convert the
renderer to an OpenGL filter.

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18b72e2e19233dc25c92ade2d0ef309c8d98774b
---

 modules/video_output/opengl/renderer.c    | 8 ++++----
 modules/video_output/opengl/renderer.h    | 7 +++----
 modules/video_output/opengl/vout_helper.c | 5 +----
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 70e05338c7..c98d2f4b76 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -192,7 +192,7 @@ BuildVertexShader(const struct vlc_gl_renderer *renderer)
     if (asprintf(&code, template, renderer->glsl_version) < 0)
         return NULL;
 
-    if (renderer->b_dump_shaders)
+    if (renderer->dump_shaders)
         msg_Dbg(renderer->gl, "\n=== Vertex shader for fourcc: %4.4s ===\n%s\n",
                 (const char *) &renderer->sampler->fmt->i_chroma, code);
     return code;
@@ -222,7 +222,7 @@ BuildFragmentShader(struct vlc_gl_renderer *renderer)
     if (ret < 0)
         return NULL;
 
-    if (renderer->b_dump_shaders)
+    if (renderer->dump_shaders)
         msg_Dbg(renderer->gl, "\n=== Fragment shader for fourcc: %4.4s, colorspace: %d ===\n%s\n",
                               (const char *) &sampler->fmt->i_chroma,
                               sampler->fmt->space, code);
@@ -318,7 +318,7 @@ 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_sampler *sampler, bool b_dump_shaders)
+                    struct vlc_gl_sampler *sampler)
 {
     const opengl_vtable_t *vt = &api->vt;
     const video_format_t *fmt = sampler->fmt;
@@ -332,7 +332,7 @@ vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
     renderer->gl = gl;
     renderer->api = api;
     renderer->vt = vt;
-    renderer->b_dump_shaders = b_dump_shaders;
+    renderer->dump_shaders = var_InheritInteger(gl, "verbose") >= 4;
 #if defined(USE_OPENGL_ES2)
     renderer->glsl_version = 100;
     renderer->glsl_precision_header = "precision highp float;\n";
diff --git a/modules/video_output/opengl/renderer.h b/modules/video_output/opengl/renderer.h
index 6e3f34b9de..af2dbd538f 100644
--- a/modules/video_output/opengl/renderer.h
+++ b/modules/video_output/opengl/renderer.h
@@ -47,8 +47,8 @@ struct vlc_gl_renderer
     const struct vlc_gl_api *api;
     const opengl_vtable_t *vt; /* for convenience, same as &api->vt */
 
-    /* True to dump shaders, set by the caller */
-    bool b_dump_shaders;
+    /* True to dump shaders */
+    bool dump_shaders;
 
     /* GLSL version, set by the caller. 100 for GLSL ES, 120 for desktop GLSL */
     unsigned glsl_version;
@@ -103,11 +103,10 @@ struct vlc_gl_renderer
  * \param gl the GL context
  * \param api the OpenGL API
  * \param sampler the OpenGL sampler
- * \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_sampler *sampler, bool dump_shaders);
+                    struct vlc_gl_sampler *sampler);
 
 /**
  * Delete a renderer
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 3cf479ae66..806360e255 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -135,8 +135,6 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         (GLint)fmt->i_height > max_tex_size)
         ResizeFormatToGLMaxTexSize(fmt, max_tex_size);
 
-    bool b_dump_shaders = var_InheritInteger(gl, "verbose") >= 4;
-
     vgl->interop = vlc_gl_interop_New(gl, &vgl->api, context, fmt, false);
     if (!vgl->interop)
     {
@@ -154,8 +152,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         return NULL;
     }
 
-    vgl->renderer =
-        vlc_gl_renderer_New(gl, &vgl->api, vgl->sampler, b_dump_shaders);
+    vgl->renderer = vlc_gl_renderer_New(gl, &vgl->api, vgl->sampler);
     if (!vgl->renderer)
     {
         msg_Warn(gl, "Could not create renderer for %4.4s",



More information about the vlc-commits mailing list