[vlc-commits] opengl: converter: pass texture sizes to pf_prepare_shader

Thomas Guillem git at videolan.org
Thu Feb 2 09:52:48 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 31 16:15:38 2017 +0100| [06423be105b5d2dd638d50262656f1b67f908d67] | committer: Thomas Guillem

opengl: converter: pass texture sizes to pf_prepare_shader

This will be used by converters that use the GL_TEXTURE_RECTANGLE tex format.

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

 modules/video_output/opengl/converter_android.c |  6 ++++--
 modules/video_output/opengl/converters.c        | 17 ++++++++++++-----
 modules/video_output/opengl/internal.h          |  6 +++++-
 modules/video_output/opengl/vout_helper.c       |  5 +++--
 4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/modules/video_output/opengl/converter_android.c b/modules/video_output/opengl/converter_android.c
index 0f034c4..b651597 100644
--- a/modules/video_output/opengl/converter_android.c
+++ b/modules/video_output/opengl/converter_android.c
@@ -162,9 +162,11 @@ tc_anop_fetch_locations(const opengl_tex_converter_t *tc, GLuint program)
 }
 
 static void
-tc_anop_prepare_shader(const opengl_tex_converter_t *tc, float alpha)
+tc_anop_prepare_shader(const opengl_tex_converter_t *tc,
+                       const GLsizei *tex_width, const GLsizei *tex_height,
+                       float alpha)
 {
-    (void) alpha;
+    (void) tex_width; (void) tex_height; (void) alpha;
     struct priv *priv = tc->priv;
     if (priv->transform_mtx != NULL)
         tc->api->UniformMatrix4fv(priv->uloc.uSTMatrix, 1, GL_FALSE,
diff --git a/modules/video_output/opengl/converters.c b/modules/video_output/opengl/converters.c
index 286b759..5e0a03e 100644
--- a/modules/video_output/opengl/converters.c
+++ b/modules/video_output/opengl/converters.c
@@ -489,8 +489,11 @@ tc_rgba_fetch_locations(const opengl_tex_converter_t *tc, GLuint program)
 }
 
 static void
-tc_rgba_prepare_shader(const opengl_tex_converter_t *tc, float alpha)
+tc_rgba_prepare_shader(const opengl_tex_converter_t *tc,
+                       const GLsizei *tex_width, const GLsizei *tex_height,
+                       float alpha)
 {
+    (void) tex_width; (void) tex_height;
     struct priv *priv = tc->priv;
     tc->api->Uniform1i(priv->uloc.Texture0, 0);
     tc->api->Uniform4f(priv->uloc.FillColor, 1.0f, 1.0f, 1.0f, alpha);
@@ -589,9 +592,11 @@ tc_yuv_fetch_locations(const opengl_tex_converter_t *tc, GLuint program)
 }
 
 static void
-tc_yuv_prepare_shader(const opengl_tex_converter_t *tc, float alpha)
+tc_yuv_prepare_shader(const opengl_tex_converter_t *tc,
+                      const GLsizei *tex_width, const GLsizei *tex_height,
+                      float alpha)
 {
-    (void) alpha;
+    (void) tex_width; (void) tex_height; (void) alpha;
     struct priv *priv = tc->priv;
     tc->api->Uniform4fv(priv->uloc.Coefficient, 4,
                         ((struct yuv_priv *)priv)->local_value);
@@ -761,9 +766,11 @@ tc_xyz12_fetch_locations(const opengl_tex_converter_t *tc, GLuint program)
 }
 
 static void
-tc_xyz12_prepare_shader(const opengl_tex_converter_t *tc, float alpha)
+tc_xyz12_prepare_shader(const opengl_tex_converter_t *tc,
+                        const GLsizei *tex_width, const GLsizei *tex_height,
+                        float alpha)
 {
-    (void) alpha;
+    (void) tex_width; (void) tex_height; (void) alpha;
     struct priv *priv = tc->priv;
     tc->api->Uniform1i(priv->uloc.Texture0, 0);
 }
diff --git a/modules/video_output/opengl/internal.h b/modules/video_output/opengl/internal.h
index 7cb6e27..c8b880c 100644
--- a/modules/video_output/opengl/internal.h
+++ b/modules/video_output/opengl/internal.h
@@ -252,9 +252,13 @@ struct opengl_tex_converter_t
      * specify values of uniform variables.
      *
      * \param fc OpenGL tex converter
+     * \param tex_width array of tex width (one per plane)
+     * \param tex_height array of tex height (one per plane)
      * \param alpha alpha value, used only for RGBA fragment shader
      */
-    void (*pf_prepare_shader)(const opengl_tex_converter_t *fc, float alpha);
+    void (*pf_prepare_shader)(const opengl_tex_converter_t *fc,
+                              const GLsizei *tex_width, const GLsizei *tex_height,
+                              float alpha);
 
     /*
      * Callback to release the shader and the private context
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index d304867..ae12343 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -1376,7 +1376,7 @@ static int SetupCoords(vout_display_opengl_t *vgl,
 static void DrawWithShaders(vout_display_opengl_t *vgl, struct prgm *prgm)
 {
     opengl_tex_converter_t *tc = &prgm->tc;
-    tc->pf_prepare_shader(tc, 1.0f);
+    tc->pf_prepare_shader(tc, vgl->tex_width, vgl->tex_height, 1.0f);
 
     for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
         assert(vgl->texture[j] != 0);
@@ -1513,7 +1513,8 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
 
         assert(glr->texture != 0);
         glBindTexture(tc->tex_target, glr->texture);
-        tc->pf_prepare_shader(tc, glr->alpha);
+
+        tc->pf_prepare_shader(tc, &glr->width, &glr->height, glr->alpha);
 
         vgl->api.BindBuffer(GL_ARRAY_BUFFER, vgl->subpicture_buffer_object[2 * i]);
         vgl->api.BufferData(GL_ARRAY_BUFFER, sizeof(textureCoord), textureCoord, GL_STATIC_DRAW);



More information about the vlc-commits mailing list