From edf9ecaf435d230671f78e54b8f7cbd613081040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 2 Jun 2015 09:25:13 +0300 Subject: [PATCH] mesa: set variables non static in version override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit before 9b5e92f get_gl_override was called only once, but now it is called for multiple APIs (GLES2, GL), version needs to be set always. Signed-off-by: Tapani Pälli Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90797 --- src/mesa/main/version.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 409e5ae..3551f12 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -58,37 +58,33 @@ get_gl_override(gl_api api, int *version, bool *fwd_context, ? "MESA_GL_VERSION_OVERRIDE" : "MESA_GLES_VERSION_OVERRIDE"; const char *version_str; int major, minor, n; - static int override_version = -1; - static bool fc_suffix = false; - static bool compat_suffix = false; + int override_version = 0; + bool fc_suffix = false; + bool compat_suffix = false; if (api == API_OPENGLES) return; - if (override_version < 0) { - override_version = 0; - - version_str = getenv(env_var); - if (version_str) { - fc_suffix = check_for_ending(version_str, "FC"); - compat_suffix = check_for_ending(version_str, "COMPAT"); - - n = sscanf(version_str, "%u.%u", &major, &minor); - if (n != 2) { + version_str = getenv(env_var); + if (version_str) { + fc_suffix = check_for_ending(version_str, "FC"); + compat_suffix = check_for_ending(version_str, "COMPAT"); + + n = sscanf(version_str, "%u.%u", &major, &minor); + if (n != 2) { + fprintf(stderr, "error: invalid value for %s: %s\n", + env_var, version_str); + override_version = 0; + } else { + override_version = major * 10 + minor; + + /* There is no such thing as compatibility or forward-compatible for + * OpenGL ES 2.0 or 3.x APIs. + */ + if ((override_version < 30 && fc_suffix) || + (api == API_OPENGLES2 && (fc_suffix || compat_suffix))) { fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version_str); - override_version = 0; - } else { - override_version = major * 10 + minor; - - /* There is no such thing as compatibility or forward-compatible for - * OpenGL ES 2.0 or 3.x APIs. - */ - if ((override_version < 30 && fc_suffix) || - (api == API_OPENGLES2 && (fc_suffix || compat_suffix))) { - fprintf(stderr, "error: invalid value for %s: %s\n", - env_var, version_str); - } } } } -- 2.1.0