[vlc-devel] [PATCH v2 14/17] opengl: simplify pf_prepare_shader()

Romain Vimont rom1v at videolabs.io
Thu May 14 15:38:12 CEST 2020


Remove tex_width and tex_height parameters, as they are either unused or
accessible from the sampler itself.
---
 modules/video_output/opengl/fragment_shaders.c | 14 ++++----------
 modules/video_output/opengl/renderer.c         |  3 +--
 modules/video_output/opengl/sampler.h          |  6 +-----
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index a15bca319cb..68b12ae4e7d 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -277,11 +277,8 @@ GetTransformMatrix(const struct vlc_gl_interop *interop)
 }
 
 static void
-sampler_base_prepare_shader(const struct vlc_gl_sampler *sampler,
-                            const GLsizei *tex_width,
-                            const GLsizei *tex_height)
+sampler_base_prepare_shader(const struct vlc_gl_sampler *sampler)
 {
-    (void) tex_width; (void) tex_height;
     const struct vlc_gl_interop *interop = sampler->interop;
     const opengl_vtable_t *vt = sampler->vt;
 
@@ -310,8 +307,8 @@ sampler_base_prepare_shader(const struct vlc_gl_sampler *sampler,
     if (interop->tex_target == GL_TEXTURE_RECTANGLE)
     {
         for (unsigned i = 0; i < interop->tex_count; ++i)
-            vt->Uniform2f(sampler->uloc.TexSize[i], tex_width[i],
-                          tex_height[i]);
+            vt->Uniform2f(sampler->uloc.TexSize[i], sampler->tex_width[i],
+                          sampler->tex_height[i]);
     }
 
 #ifdef HAVE_LIBPLACEBO
@@ -376,11 +373,8 @@ sampler_xyz12_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
 }
 
 static void
-sampler_xyz12_prepare_shader(const struct vlc_gl_sampler *sampler,
-                             const GLsizei *tex_width,
-                             const GLsizei *tex_height)
+sampler_xyz12_prepare_shader(const struct vlc_gl_sampler *sampler)
 {
-    (void) tex_width; (void) tex_height;
     const struct vlc_gl_interop *interop = sampler->interop;
     const opengl_vtable_t *vt = sampler->vt;
 
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index f5441983452..6dd2684683a 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -831,8 +831,7 @@ static void DrawWithShaders(struct vlc_gl_renderer *renderer)
 {
     struct vlc_gl_sampler *sampler = renderer->sampler;
     const opengl_vtable_t *vt = renderer->vt;
-    sampler->pf_prepare_shader(sampler, sampler->tex_width,
-                               sampler->tex_height);
+    sampler->pf_prepare_shader(sampler);
 
     vt->BindBuffer(GL_ARRAY_BUFFER, renderer->texture_buffer_object);
     assert(renderer->aloc.PicCoordsIn != -1);
diff --git a/modules/video_output/opengl/sampler.h b/modules/video_output/opengl/sampler.h
index c295083df29..7ef2d950c3a 100644
--- a/modules/video_output/opengl/sampler.h
+++ b/modules/video_output/opengl/sampler.h
@@ -109,12 +109,8 @@ struct vlc_gl_sampler {
      * specify values of uniform variables.
      *
      * \param sampler the sampler
-     * \param tex_width array of tex width (one per plane)
-     * \param tex_height array of tex height (one per plane)
      */
-    void (*pf_prepare_shader)(const struct vlc_gl_sampler *sampler,
-                              const GLsizei *tex_width,
-                              const GLsizei *tex_height);
+    void (*pf_prepare_shader)(const struct vlc_gl_sampler *sampler);
 };
 
 /**
-- 
2.26.2



More information about the vlc-devel mailing list