[vlc-commits] Used opengl.h HasExtension() when applicable.

Laurent Aimar git at videolan.org
Thu Jun 2 19:15:32 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jun  2 19:09:45 2011 +0200| [55f46a920af32c7c2be4bec2a39ea94114309ee9] | committer: Laurent Aimar

Used opengl.h HasExtension() when applicable.

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

 modules/video_output/opengl.c  |   10 ++++------
 modules/video_output/xcb/glx.c |    4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 1295bf6..ae24f0c 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -154,12 +154,10 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
 
     const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
-    if (!extensions)
-        extensions = "";
 
     /* Load extensions */
     bool supports_fp = false;
-    if (strstr(extensions, "GL_ARB_fragment_program")) {
+    if (HasExtension(extensions, "GL_ARB_fragment_program")) {
         vgl->GenProgramsARB    = (PFNGLGENPROGRAMSARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenProgramsARB");
         vgl->BindProgramARB    = (PFNGLBINDPROGRAMARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindProgramARB");
         vgl->ProgramStringARB  = (PFNGLPROGRAMSTRINGARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glProgramStringARB");
@@ -175,7 +173,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
 
     bool supports_multitexture = false;
     GLint max_texture_units = 0;
-    if (strstr(extensions, "GL_ARB_multitexture")) {
+    if (HasExtension(extensions, "GL_ARB_multitexture")) {
         vgl->ActiveTextureARB   = (PFNGLACTIVETEXTUREARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glActiveTextureARB");
         vgl->MultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glMultiTexCoord2fARB");
 
@@ -253,8 +251,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
 #elif defined(MACOS_OPENGL)
     supports_npot = true;
 #else
-    supports_npot |= strstr(extensions, "GL_APPLE_texture_2D_limited_npot") != NULL ||
-                     strstr(extensions, "GL_ARB_texture_non_power_of_two");
+    supports_npot |= HasExtension(extensions, "GL_APPLE_texture_2D_limited_npot") ||
+                     HasExtension(extensions, "GL_ARB_texture_non_power_of_two");
 #endif
 
     /* Texture size */
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index e1fc6dd..f81c9fc 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -364,14 +364,14 @@ static int Open (vlc_object_t *obj)
 
     bool is_swap_interval_set = false;
 #ifdef GLX_SGI_swap_control
-    if (strstr (glx_extensions, "GLX_SGI_swap_control")) {
+    if (HasExtension (glx_extensions, "GLX_SGI_swap_control")) {
         PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)GetProcAddress (NULL, "glXSwapIntervalSGI");
         if (!is_swap_interval_set && SwapIntervalSGI)
             is_swap_interval_set = !SwapIntervalSGI (1);
     }
 #endif
 #ifdef GLX_EXT_swap_control
-    if (strstr (glx_extensions, "GLX_EXT_swap_control")) {
+    if (HasExtension (glx_extensions, "GLX_EXT_swap_control")) {
         PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)GetProcAddress (NULL, "glXSwapIntervalEXT");
         if (!is_swap_interval_set && SwapIntervalEXT)
             is_swap_interval_set = !SwapIntervalEXT (dpy, sys->glwin, 1);



More information about the vlc-commits mailing list