From b487b9d3b6a3997989218e062e9ee7276ab5f428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Thu, 4 Jun 2015 08:55:05 +0300 Subject: [PATCH] mesa: set override_version per api 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 | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 409e5ae..5e9943c 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -58,34 +58,42 @@ 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; + static struct override_info { + int version; + bool fc_suffix; + bool compat_suffix; + } override[API_OPENGL_LAST + 1] = { + { -1, false, false}, + { -1, false, false}, + { -1, false, false}, + { -1, false, false}, + }; if (api == API_OPENGLES) return; - if (override_version < 0) { - override_version = 0; + if (override[api].version < 0) { + override[api].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"); + override[api].fc_suffix = check_for_ending(version_str, "FC"); + override[api].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; + override[api].version = 0; } else { - override_version = major * 10 + minor; + override[api].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))) { + if ((override[api].version < 30 && override[api].fc_suffix) || + (api == API_OPENGLES2 && (override[api].fc_suffix || + override[api].compat_suffix))) { fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version_str); } @@ -93,9 +101,9 @@ get_gl_override(gl_api api, int *version, bool *fwd_context, } } - *version = override_version; - *fwd_context = fc_suffix; - *compat_context = compat_suffix; + *version = override[api].version; + *fwd_context = override[api].fc_suffix; + *compat_context = override[api].compat_suffix; } /** -- 2.1.0