aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/version.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-29 16:21:42 +0200
committermarha <marha@users.sourceforge.net>2011-09-29 16:21:42 +0200
commit4a9e1f51655e03da1507dabce7c4c3960e7ca607 (patch)
tree0298f6e38550e2f888eab0146ce7a51a49faaa10 /mesalib/src/mesa/main/version.c
parent0e68f72b7b0ab957a0d3c9415f68e3c4f484b0b3 (diff)
parentbee9191042416cbfb848615189ca1e2a0069f022 (diff)
downloadvcxsrv-4a9e1f51655e03da1507dabce7c4c3960e7ca607.tar.gz
vcxsrv-4a9e1f51655e03da1507dabce7c4c3960e7ca607.tar.bz2
vcxsrv-4a9e1f51655e03da1507dabce7c4c3960e7ca607.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/version.c')
-rw-r--r--mesalib/src/mesa/main/version.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 3b5a78d1b..738b5cb61 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -44,7 +44,7 @@ override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
return;
}
- n = sscanf(version, "%d.%d", major, minor);
+ n = sscanf(version, "%u.%u", major, minor);
if (n != 2) {
fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
return;
@@ -52,6 +52,30 @@ override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
}
/**
+ * Override the context's GLSL version if the environment variable
+ * MESA_GLSL_VERSION_OVERRIDE is set. Valid values for
+ * MESA_GLSL_VERSION_OVERRIDE are integers, such as "130".
+ */
+void
+_mesa_override_glsl_version(struct gl_context *ctx)
+{
+ const char *env_var = "MESA_GLSL_VERSION_OVERRIDE";
+ const char *version;
+ int n;
+
+ version = getenv(env_var);
+ if (!version) {
+ return;
+ }
+
+ n = sscanf(version, "%u", &ctx->Const.GLSLVersion);
+ if (n != 1) {
+ fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
+ return;
+ }
+}
+
+/**
* Examine enabled GL extensions to determine GL version.
* Return major and minor version numbers.
*/