mesa: set override_version per api version override

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 <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90797
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
This commit is contained in:
Tapani Pälli
2015-06-16 13:46:47 +03:00
committed by Martin Peres
parent 1a6220b416
commit 7d88ab42b9

View File

@@ -58,34 +58,44 @@ get_gl_override(gl_api api, int *version, bool *fwd_context,
? "MESA_GL_VERSION_OVERRIDE" : "MESA_GLES_VERSION_OVERRIDE"; ? "MESA_GL_VERSION_OVERRIDE" : "MESA_GLES_VERSION_OVERRIDE";
const char *version_str; const char *version_str;
int major, minor, n; int major, minor, n;
static int override_version = -1; static struct override_info {
static bool fc_suffix = false; int version;
static bool compat_suffix = false; bool fc_suffix;
bool compat_suffix;
} override[] = {
{ -1, false, false},
{ -1, false, false},
{ -1, false, false},
{ -1, false, false},
};
STATIC_ASSERT(ARRAY_SIZE(override) == API_OPENGL_LAST + 1);
if (api == API_OPENGLES) if (api == API_OPENGLES)
goto exit; goto exit;
if (override_version < 0) { if (override[api].version < 0) {
override_version = 0; override[api].version = 0;
version_str = getenv(env_var); version_str = getenv(env_var);
if (version_str) { if (version_str) {
fc_suffix = check_for_ending(version_str, "FC"); override[api].fc_suffix = check_for_ending(version_str, "FC");
compat_suffix = check_for_ending(version_str, "COMPAT"); override[api].compat_suffix = check_for_ending(version_str, "COMPAT");
n = sscanf(version_str, "%u.%u", &major, &minor); n = sscanf(version_str, "%u.%u", &major, &minor);
if (n != 2) { if (n != 2) {
fprintf(stderr, "error: invalid value for %s: %s\n", fprintf(stderr, "error: invalid value for %s: %s\n",
env_var, version_str); env_var, version_str);
override_version = 0; override[api].version = 0;
} else { } else {
override_version = major * 10 + minor; override[api].version = major * 10 + minor;
/* There is no such thing as compatibility or forward-compatible for /* There is no such thing as compatibility or forward-compatible for
* OpenGL ES 2.0 or 3.x APIs. * OpenGL ES 2.0 or 3.x APIs.
*/ */
if ((override_version < 30 && fc_suffix) || if ((override[api].version < 30 && override[api].fc_suffix) ||
(api == API_OPENGLES2 && (fc_suffix || compat_suffix))) { (api == API_OPENGLES2 && (override[api].fc_suffix ||
override[api].compat_suffix))) {
fprintf(stderr, "error: invalid value for %s: %s\n", fprintf(stderr, "error: invalid value for %s: %s\n",
env_var, version_str); env_var, version_str);
} }
@@ -94,9 +104,9 @@ get_gl_override(gl_api api, int *version, bool *fwd_context,
} }
exit: exit:
*version = override_version; *version = override[api].version;
*fwd_context = fc_suffix; *fwd_context = override[api].fc_suffix;
*compat_context = compat_suffix; *compat_context = override[api].compat_suffix;
} }
/** /**