0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

vo_opengl: remove legacy GL detection

This detected whether an OpenGL context still provided legacy OpenGL if
the OpenGL version is modern (>= 3.0). This was actually only needed for
vo_opengl_old, because it relied on legacy functions. Since it's gone,
this code isn't needed either.

(Also, the removed comment about OpenGL 3.0 was wrong: you could just
query GL_CONTEXT_FLAGS and see if the forward compatible bit was set.)
This commit is contained in:
wm4 2015-07-24 23:34:43 +02:00
parent 9f65629bd0
commit bdc60daffa

View File

@ -356,12 +356,6 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
if (shader)
mp_verbose(log, "GL_SHADING_LANGUAGE_VERSION='%s'\n", shader);
// Note: This code doesn't handle CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
// on OpenGL 3.0 correctly. Apparently there's no way to detect this
// situation, because GL_ARB_compatibility is specified only for 3.1
// and above.
bool has_legacy = false;
if (gl->version >= 300) {
gl->GetStringi = get_fn(fn_ctx, "glGetStringi");
gl->GetIntegerv = get_fn(fn_ctx, "glGetIntegerv");
@ -374,26 +368,13 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
for (int n = 0; n < exts; n++) {
const char *ext = gl->GetStringi(GL_EXTENSIONS, n);
gl->extensions = talloc_asprintf_append(gl->extensions, " %s", ext);
if (strcmp(ext, "GL_ARB_compatibility") == 0)
has_legacy = true;
}
// This version doesn't have GL_ARB_compatibility yet, and always
// includes legacy (except with CONTEXT_FORWARD_COMPATIBLE_BIT_ARB).
if (gl->version == 300)
has_legacy = true;
} else {
const char *ext = (char*)gl->GetString(GL_EXTENSIONS);
gl->extensions = talloc_asprintf_append(gl->extensions, " %s", ext);
has_legacy = true;
}
if (gl->es)
has_legacy = false;
if (has_legacy)
mp_verbose(log, "OpenGL legacy compat. found.\n");
mp_dbg(log, "Combined OpenGL extensions string:\n%s\n", gl->extensions);
for (int n = 0; n < sizeof(gl_functions) / sizeof(gl_functions[0]); n++) {
@ -402,10 +383,7 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
int ver_core = gl->es ? section->ver_es_core : section->ver_core;
int ver_removed = gl->es ? section->ver_es_removed : section->ver_removed;
// With has_legacy, the legacy functions are still available, and
// functions are never actually removed. (E.g. the context could be at
// version >= 3.0, but functions like glBegin still exist and work.)
if (!has_legacy && ver_removed && version >= ver_removed)
if (ver_removed && version >= ver_removed)
continue;
// NOTE: Function entrypoints can exist, even if they do not work.