[vlc-devel] [PATCH] [3.x] opengl: fix shader support check

Jean-Baptiste Kempf jb at videolan.org
Thu Feb 20 00:24:13 CET 2020


LGTM.

On Thu, Feb 20, 2020, at 00:06, Marvin Scholz wrote:
> Even with OpenGL versions lower than 2.0 GLSL can be supported,
> so fallback to checking the GLSL version.
> 
> Fix #21438
> ---
>  modules/video_output/opengl/vout_helper.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/modules/video_output/opengl/vout_helper.c 
> b/modules/video_output/opengl/vout_helper.c
> index 919560e603..80b71ac858 100644
> --- a/modules/video_output/opengl/vout_helper.c
> +++ b/modules/video_output/opengl/vout_helper.c
> @@ -855,13 +855,17 @@ vout_display_opengl_t 
> *vout_display_opengl_New(video_format_t *fmt,
>          return NULL;
>      }
>  #if !defined(USE_OPENGL_ES2)
> +    // Check for OpenGL < 2.0
>      const unsigned char *ogl_version = vgl->vt.GetString(GL_VERSION);
> -    bool supports_shaders = strverscmp((const char *)ogl_version, 
> "2.0") >= 0;
> -    if (!supports_shaders)
> -    {
> -        msg_Err(gl, "shaders not supported, bailing out\n");
> -        free(vgl);
> -        return NULL;
> +    if (strverscmp((const char *)ogl_version, "2.0") < 0) {
> +        // Even with OpenGL < 2.0 we might have GLSL support,
> +        // so check the GLSL version before finally giving up:
> +        const unsigned char *glsl_version = 
> vgl->vt.GetString(GL_SHADING_LANGUAGE_VERSION);
> +        if (!glsl_version || strverscmp((const char *)glsl_version, 
> "1.10") < 0) {
> +            msg_Err(gl, "shaders not supported, bailing out\n");
> +            free(vgl);
> +            return NULL;
> +        }
>      }
>  #endif
>  
> -- 
> 2.21.1 (Apple Git-122.3)
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list