diff options
author | marha <marha@users.sourceforge.net> | 2011-09-28 15:25:22 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-28 15:25:22 +0200 |
commit | c958cf29a8265091c4f68bb842a1d07c47e181fa (patch) | |
tree | 9cdba0da6a601cd16a9c34c544c51be1aa7075fc /mesalib/src/mesa/main/version.c | |
parent | 756ccf7af09d35176962e44587244580c2cd0f22 (diff) | |
parent | 18a8f9f6839dfd899814a76a971e720c1e622236 (diff) | |
download | vcxsrv-c958cf29a8265091c4f68bb842a1d07c47e181fa.tar.gz vcxsrv-c958cf29a8265091c4f68bb842a1d07c47e181fa.tar.bz2 vcxsrv-c958cf29a8265091c4f68bb842a1d07c47e181fa.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/version.c')
-rw-r--r-- | mesalib/src/mesa/main/version.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index b2d507786..3b5a78d1b 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -27,7 +27,29 @@ #include "version.h" /*#include "git_sha1.h"*/ +/** + * Override the context's GL version if the environment variable + * MESA_GL_VERSION_OVERRIDE is set. Valid values of MESA_GL_VERSION_OVERRIDE + * are point-separated version numbers, such as "3.0". + */ +static void +override_version(struct gl_context *ctx, GLuint *major, GLuint *minor) +{ + const char *env_var = "MESA_GL_VERSION_OVERRIDE"; + const char *version; + int n; + + version = getenv(env_var); + if (!version) { + return; + } + n = sscanf(version, "%d.%d", major, minor); + if (n != 2) { + fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version); + return; + } +} /** * Examine enabled GL extensions to determine GL version. @@ -178,6 +200,9 @@ compute_version(struct gl_context *ctx) ctx->VersionMajor = major; ctx->VersionMinor = minor; + + override_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor); + ctx->VersionString = (char *) malloc(max); if (ctx->VersionString) { _mesa_snprintf(ctx->VersionString, max, |