[vlc-commits] [Git][videolan/vlc][master] 4 commits: egl_surfacetexture: use vlc_gl_HasExtension

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Wed Jan 26 08:21:23 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
6f2ff8ac by Alexandre Janniaux at 2022-01-26T06:47:02+00:00
egl_surfacetexture: use vlc_gl_HasExtension

- - - - -
c843e022 by Alexandre Janniaux at 2022-01-26T06:47:02+00:00
opengl: gl_api: use vlc_gl_HasExtension

- - - - -
8a35a7a1 by Alexandre Janniaux at 2022-01-26T06:47:02+00:00
opengl: sampler: use vlc_gl_HasExtension

- - - - -
6896b561 by Alexandre Janniaux at 2022-01-26T06:47:02+00:00
opengl: gl_api: remove extension field

The clients wanting to find an extension are now using
vlc_gl_HasExtension, which doesn't prevent from using a Core OpenGL
profile, as opposed to the glGetString(GL_EXTENSIONS) call.

- - - - -


4 changed files:

- modules/video_filter/egl_surfacetexture.c
- modules/video_output/opengl/gl_api.c
- modules/video_output/opengl/gl_api.h
- modules/video_output/opengl/sampler.c


Changes:

=====================================
modules/video_filter/egl_surfacetexture.c
=====================================
@@ -399,11 +399,13 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
         vlc_gl_ReleaseCurrent(gl);
         goto error4;
     }
-    const char *extensions =
-        (const char *) sys->api.vt.GetString(GL_EXTENSIONS);
+
+
+    bool has_image_external =
+        vlc_gl_HasExtension(gl, "GL_OES_EGL_image_external");
     vlc_gl_ReleaseCurrent(gl);
 
-    if (!vlc_gl_StrHasToken(extensions, "GL_OES_EGL_image_external"))
+    if (!has_image_external)
     {
         msg_Warn(gl, "GL_OES_EGL_image_external is not available,"
                 " disabling egl_surfacetexture.");


=====================================
modules/video_output/opengl/gl_api.c
=====================================
@@ -151,16 +151,6 @@ vlc_gl_api_Init(struct vlc_gl_api *api, vlc_gl_t *gl)
     GET_PROC_ADDR_OPTIONAL(ClientWaitSync);
 #undef GET_PROC_ADDR
 
-    GL_ASSERT_NOERROR(&api->vt);
-
-    api->extensions = (const char *) api->vt.GetString(GL_EXTENSIONS);
-    assert(api->extensions);
-    if (!api->extensions)
-    {
-        msg_Err(gl, "glGetString returned NULL");
-        return VLC_EGENERIC;
-    }
-
     GL_ASSERT_NOERROR(&api->vt);
     GLint version;
     api->vt.GetIntegerv(GL_MAJOR_VERSION, &version);
@@ -187,8 +177,8 @@ vlc_gl_api_Init(struct vlc_gl_api *api, vlc_gl_t *gl)
     else
     {
         api->is_gles = false;
-        api->supports_npot = vlc_gl_StrHasToken(api->extensions, "GL_ARB_texture_non_power_of_two") ||
-                             vlc_gl_StrHasToken(api->extensions, "GL_APPLE_texture_2D_limited_npot");
+        api->supports_npot = vlc_gl_HasExtension(gl, "GL_ARB_texture_non_power_of_two") ||
+                             vlc_gl_HasExtension(gl, "GL_APPLE_texture_2D_limited_npot");
     }
 
     return VLC_SUCCESS;


=====================================
modules/video_output/opengl/gl_api.h
=====================================
@@ -38,9 +38,6 @@ struct vlc_gl_api {
     /* True if the current API is OpenGL ES, set by the caller */
     bool is_gles;
 
-    /* Available gl extensions (from GL_EXTENSIONS) */
-    const char *extensions;
-
     /* Non-power-of-2 texture size support */
     bool supports_npot;
 


=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -424,7 +424,7 @@ opengl_init_swizzle(struct vlc_gl_sampler *sampler,
     struct vlc_gl_sampler_priv *priv = PRIV(sampler);
 
     GLint oneplane_texfmt;
-    if (vlc_gl_StrHasToken(priv->api->extensions, "GL_ARB_texture_rg"))
+    if (vlc_gl_HasExtension(priv->gl, "GL_ARB_texture_rg"))
         oneplane_texfmt = GL_RED;
     else
         oneplane_texfmt = GL_LUMINANCE;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8e0898a8e3d1b8154c65bfc77a35a2bb994997e5...6896b5611a5be62cbd5c798f9993e5a62052fa5e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8e0898a8e3d1b8154c65bfc77a35a2bb994997e5...6896b5611a5be62cbd5c798f9993e5a62052fa5e
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list