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

Romain Vimont rom1v at videolabs.io
Thu Apr 2 14:24:27 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 e9465718a3..9fd50c8600 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -276,11 +276,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;
 
@@ -309,8 +306,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
@@ -375,11 +372,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 f544198345..6dd2684683 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 c295083df2..7ef2d950c3 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.0



More information about the vlc-devel mailing list