From 930f8415892dd6d030fc4be3d7a72b2eed9d1467 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 9 Nov 2015 14:28:56 +0100 Subject: vo_opengl: simplify GLSL version detection Pick the correct GLSL version from the GL_SHADING_LANGUAGE_VERSION string. Might be somewhat questionable, as we expect the minor version number not to have leading 0s. Should help with cases when the reported GLSL version is much higher than the equivalent of the reported GL version. This problem was observed in combination with GL_ARB_uniform_buffer_object, which can't be used if the declared GLSL version is too low. --- video/out/opengl/common.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index afb732fa9e..88b1270853 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -465,16 +465,10 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), if (gl->es >= 300) gl->glsl_version = 300; } else { - if (gl->version >= 200) - gl->glsl_version = 110; - if (gl->version >= 210) - gl->glsl_version = 120; - if (gl->version >= 300) - gl->glsl_version = 130; - if (gl->version >= 320) - gl->glsl_version = 150; - if (gl->version >= 330) - gl->glsl_version = 330; + gl->glsl_version = 110; + int glsl_major = 0, glsl_minor = 0; + if (sscanf(shader, "%d.%d", &glsl_major, &glsl_minor) == 2) + gl->glsl_version = glsl_major * 100 + glsl_minor; } if (is_software_gl(gl)) { -- cgit v1.2.3