[vlc-devel] [PATCH 08/11] vout/opengl: move chroma and tex size initialisation

Thomas Guillem thomas at gllm.fr
Wed Dec 14 17:16:13 CET 2016


---
 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 362a234..3e34444 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -626,22 +626,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] =
@@ -742,6 +726,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);
-- 
2.10.2



More information about the vlc-devel mailing list