[vlc-commits] vout/opengl: move chroma and tex size initialisation

Thomas Guillem git at videolan.org
Mon Dec 19 12:06:41 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec 14 16:21:30 2016 +0100| [c3b2338ab1bce1b2b359f5bc29f7fc5ee872067d] | committer: Thomas Guillem

vout/opengl: move chroma and tex size initialisation

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

 modules/video_output/opengl/vout_helper.c | 35 +++++++++++++++++--------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 388ffcd..a6cb827 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -621,22 +621,6 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         vgl->tex_internal = GL_RGB;
         vgl->tex_type     = GL_UNSIGNED_SHORT;
     }
-    vgl->chroma = vlc_fourcc_GetChromaDescription(vgl->fmt.i_chroma);
-    vgl->sub_chroma = vlc_fourcc_GetChromaDescription(VLC_CODEC_RGB32);
-    assert(vgl->chroma != NULL && vgl->sub_chroma != NULL);
-
-    /* Texture size */
-    for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
-        int w = vgl->fmt.i_visible_width  * vgl->chroma->p[j].w.num / vgl->chroma->p[j].w.den;
-        int h = vgl->fmt.i_visible_height * vgl->chroma->p[j].h.num / vgl->chroma->p[j].h.den;
-        if (vgl->supports_npot) {
-            vgl->tex_width[j]  = w;
-            vgl->tex_height[j] = h;
-        } else {
-            vgl->tex_width[j]  = GetAlignedSize(w);
-            vgl->tex_height[j] = GetAlignedSize(h);
-        }
-    }
 
     /* Build program if needed */
     vgl->program[0] =
@@ -736,6 +720,25 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         }
     }
 
+    vgl->chroma = vlc_fourcc_GetChromaDescription(vgl->fmt.i_chroma);
+    vgl->sub_chroma = vlc_fourcc_GetChromaDescription(VLC_CODEC_RGB32);
+    assert(vgl->chroma != NULL && vgl->sub_chroma != NULL);
+
+    /* Texture size */
+    for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
+        int w = vgl->fmt.i_visible_width  * vgl->chroma->p[j].w.num
+              / vgl->chroma->p[j].w.den;
+        int h = vgl->fmt.i_visible_height * vgl->chroma->p[j].h.num
+              / vgl->chroma->p[j].h.den;
+        if (vgl->supports_npot) {
+            vgl->tex_width[j]  = w;
+            vgl->tex_height[j] = h;
+        } else {
+            vgl->tex_width[j]  = GetAlignedSize(w);
+            vgl->tex_height[j] = GetAlignedSize(h);
+        }
+    }
+
     /* */
     glDisable(GL_BLEND);
     glDisable(GL_DEPTH_TEST);



More information about the vlc-commits mailing list