[vlc-devel] [PATCH 14/24] opengl: make supports_npot local

Romain Vimont rom1v at videolabs.io
Mon Jan 27 21:20:04 CET 2020


The field was used only from vout_display_opengl_New().
---
 modules/video_output/opengl/vout_helper.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index e1f77b415b..fa9bfd94c6 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -123,9 +123,6 @@ struct vout_display_opengl_t {
         unsigned int i_visible_height;
     } last_source;
 
-    /* Non-power-of-2 texture size support */
-    bool supports_npot;
-
     /* View point */
     vlc_viewpoint_t vp;
     float f_teta;
@@ -684,19 +681,21 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         (GLint)fmt->i_height > max_tex_size)
         ResizeFormatToGLMaxTexSize(fmt, max_tex_size);
 
+    /* Non-power-of-2 texture size support */
+    bool supports_npot;
 #if defined(USE_OPENGL_ES2)
     /* OpenGL ES 2 includes support for non-power of 2 textures by specification
      * so checks for extensions are bound to fail. Check for OpenGL ES version instead. */
-    vgl->supports_npot = true;
+    supports_npot = true;
 #else
-    vgl->supports_npot = vlc_gl_StrHasToken(extensions, "GL_ARB_texture_non_power_of_two") ||
-                         vlc_gl_StrHasToken(extensions, "GL_APPLE_texture_2D_limited_npot");
+    supports_npot = vlc_gl_StrHasToken(extensions, "GL_ARB_texture_non_power_of_two") ||
+                    vlc_gl_StrHasToken(extensions, "GL_APPLE_texture_2D_limited_npot");
 #endif
 
     bool b_dump_shaders = var_InheritInteger(gl, "verbose") >= 4;
 
     vgl->sub_renderer =
-        vlc_gl_sub_renderer_New(vgl->gl, &vgl->vt, vgl->supports_npot);
+        vlc_gl_sub_renderer_New(vgl->gl, &vgl->vt, supports_npot);
     if (!vgl->sub_renderer)
     {
         msg_Err(gl, "Could not create sub renderer");
@@ -730,7 +729,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
                         / interop->texs[j].w.den;
         const GLsizei h = vgl->fmt.i_visible_height * interop->texs[j].h.num
                         / interop->texs[j].h.den;
-        if (vgl->supports_npot) {
+        if (supports_npot) {
             vgl->tex_width[j]  = w;
             vgl->tex_height[j] = h;
         } else {
-- 
2.25.0



More information about the vlc-devel mailing list