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.
This commit is contained in:
wm4 2015-11-09 14:28:56 +01:00
parent 8baf773d0e
commit 930f841589
1 changed files with 4 additions and 10 deletions

View File

@ -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)) {