[vlc-devel] [PATCH 27/41] opengl: simplify pf_prepare_shader()

Romain Vimont rom1v at videolabs.io
Fri Feb 7 17:42:13 CET 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 aed5844a4c..b79a57fb0a 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -265,11 +265,8 @@ sampler_base_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
 }
 
 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;
 
@@ -302,8 +299,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
@@ -350,11 +347,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 opengl_vtable_t *vt = sampler->vt;
 
     vt->Uniform1i(sampler->uloc.Texture[0], 0);
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index c4b137d455..122535d835 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -834,8 +834,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 25b818cbe0..794f32df69 100644
--- a/modules/video_output/opengl/sampler.h
+++ b/modules/video_output/opengl/sampler.h
@@ -110,12 +110,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.25.0



More information about the vlc-devel mailing list