[vlc-devel] [PATCH 04/11] vout/opengl: assume that multitexture is true

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


It's safe to call glActiveTexture(GL_TEXTURE0 + 0), even if there is only one
texture.
---
 modules/video_output/opengl/vout_helper.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index f3a249f..8756e49 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -198,10 +198,6 @@ struct vout_display_opengl_t {
     PFNGLCLIENTACTIVETEXTUREPROC  ClientActiveTexture;
 #endif
 
-
-    /* multitexture */
-    bool use_multitexture;
-
     /* Non-power-of-2 texture size support */
     bool supports_npot;
 
@@ -631,7 +627,6 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
     vgl->chroma = vlc_fourcc_GetChromaDescription(vgl->fmt.i_chroma);
     assert(vgl->chroma != NULL);
-    vgl->use_multitexture = vgl->chroma->plane_count > 1;
 
     /* Texture size */
     for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
@@ -923,10 +918,8 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
     for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++) {
         glGenTextures(vgl->chroma->plane_count, vgl->texture[i]);
         for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
-            if (vgl->use_multitexture) {
-                glActiveTexture(GL_TEXTURE0 + j);
-                glClientActiveTexture(GL_TEXTURE0 + j);
-            }
+            glActiveTexture(GL_TEXTURE0 + j);
+            glClientActiveTexture(GL_TEXTURE0 + j);
             glBindTexture(vgl->tex_target, vgl->texture[i][j]);
 
 #if !defined(USE_OPENGL_ES2)
@@ -1030,10 +1023,8 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
 
     /* Update the texture */
     for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
-        if (vgl->use_multitexture) {
-            glActiveTexture(GL_TEXTURE0 + j);
-            glClientActiveTexture(GL_TEXTURE0 + j);
-        }
+        glActiveTexture(GL_TEXTURE0 + j);
+        glClientActiveTexture(GL_TEXTURE0 + j);
         glBindTexture(vgl->tex_target, vgl->texture[0][j]);
 
         Upload(vgl, picture->format.i_visible_width, vgl->fmt.i_visible_height,
@@ -1057,10 +1048,8 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
         vgl->region_count = count;
         vgl->region       = calloc(count, sizeof(*vgl->region));
 
-        if (vgl->use_multitexture) {
-            glActiveTexture(GL_TEXTURE0 + 0);
-            glClientActiveTexture(GL_TEXTURE0 + 0);
-        }
+        glActiveTexture(GL_TEXTURE0 + 0);
+        glClientActiveTexture(GL_TEXTURE0 + 0);
         int i = 0;
         for (subpicture_region_t *r = subpicture->p_region; r; r = r->p_next, i++) {
             gl_region_t *glr = &vgl->region[i];
-- 
2.10.2



More information about the vlc-devel mailing list