aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/version.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-28 15:18:21 +0200
committermarha <marha@users.sourceforge.net>2011-09-28 15:18:21 +0200
commit18a8f9f6839dfd899814a76a971e720c1e622236 (patch)
tree42ad3d70bcbefe8f2c218468f7a1fd033b38428c /mesalib/src/mesa/main/version.c
parent183b7373f9919eeb5eb408f38578e01717b2cc10 (diff)
downloadvcxsrv-18a8f9f6839dfd899814a76a971e720c1e622236.tar.gz
vcxsrv-18a8f9f6839dfd899814a76a971e720c1e622236.tar.bz2
vcxsrv-18a8f9f6839dfd899814a76a971e720c1e622236.zip
mesa pixman xkeyboard-config git update 28 sep 2011
Diffstat (limited to 'mesalib/src/mesa/main/version.c')
-rw-r--r--mesalib/src/mesa/main/version.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 384281479..a5deeabd2 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,