summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-09 14:28:56 +0100
committerwm4 <wm4@nowhere>2015-11-09 14:29:09 +0100
commit930f8415892dd6d030fc4be3d7a72b2eed9d1467 (patch)
treea3993441f57dda1f74be8f328f65e649f24334ba
parent8baf773d0e9a02febde5a64c722a9bc233acff6e (diff)
downloadmpv-930f8415892dd6d030fc4be3d7a72b2eed9d1467.tar.bz2
mpv-930f8415892dd6d030fc4be3d7a72b2eed9d1467.tar.xz
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.
-rw-r--r--video/out/opengl/common.c14
1 files 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)) {