[vlc-commits] opengl: fix shader support check
Marvin Scholz
git at videolan.org
Thu Feb 20 11:09:04 CET 2020
vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Feb 20 00:06:21 2020 +0100| [14ca93bfe3bc6cf3d6bc99df8fca74ec0da7b10e] | committer: Marvin Scholz
opengl: fix shader support check
Even with OpenGL versions lower than 2.0 GLSL can be supported,
so fallback to checking the GLSL version.
Fix #21438
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=14ca93bfe3bc6cf3d6bc99df8fca74ec0da7b10e
---
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
More information about the vlc-commits
mailing list