diff options
author | marha <marha@users.sourceforge.net> | 2012-08-13 10:11:17 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-13 10:11:17 +0200 |
commit | f5a4fa87e844b3ea2658a2355a4c4ac3393a65a1 (patch) | |
tree | 921a5a742930124e7bd7e9a7e73f6029bd74338d /mesalib/src/mesa/main/version.c | |
parent | ec4051f308e8e84146e0ecc39b6d228e500e9636 (diff) | |
parent | 9ddf44af81782451cee798e06749ce3067a14a41 (diff) | |
download | vcxsrv-f5a4fa87e844b3ea2658a2355a4c4ac3393a65a1.tar.gz vcxsrv-f5a4fa87e844b3ea2658a2355a4c4ac3393a65a1.tar.bz2 vcxsrv-f5a4fa87e844b3ea2658a2355a4c4ac3393a65a1.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 | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index e6cc7f3cb..74e67b246 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -33,22 +33,25 @@ * are point-separated version numbers, such as "3.0". */ static void -override_version(struct gl_context *ctx, GLuint *major, GLuint *minor) +override_version(struct gl_context *ctx) { const char *env_var = "MESA_GL_VERSION_OVERRIDE"; const char *version; int n; + int major, minor; version = getenv(env_var); if (!version) { return; } - n = sscanf(version, "%u.%u", 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; } + + ctx->Version = major * 10 + minor; } /** @@ -218,10 +221,9 @@ compute_version(struct gl_context *ctx) minor = 2; } - ctx->VersionMajor = major; - ctx->VersionMinor = minor; + ctx->Version = major * 10 + minor; - override_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor); + override_version(ctx); ctx->VersionString = (char *) malloc(max); if (ctx->VersionString) { @@ -231,7 +233,7 @@ compute_version(struct gl_context *ctx) " (" MESA_GIT_SHA1 ")" #endif , - ctx->VersionMajor, ctx->VersionMinor); + ctx->Version / 10, ctx->Version % 10); } } @@ -248,11 +250,9 @@ compute_version_es1(struct gl_context *ctx) ctx->Extensions.EXT_point_parameters); if (ver_1_1) { - ctx->VersionMajor = 1; - ctx->VersionMinor = 1; + ctx->Version = 11; } else if (ver_1_0) { - ctx->VersionMajor = 1; - ctx->VersionMinor = 0; + ctx->Version = 10; } else { _mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support."); } @@ -265,7 +265,7 @@ compute_version_es1(struct gl_context *ctx) " (" MESA_GIT_SHA1 ")" #endif , - ctx->VersionMinor); + ctx->Version % 10); } } @@ -285,8 +285,7 @@ compute_version_es2(struct gl_context *ctx) ctx->Extensions.ARB_texture_non_power_of_two && ctx->Extensions.EXT_blend_equation_separate); if (ver_2_0) { - ctx->VersionMajor = 2; - ctx->VersionMinor = 0; + ctx->Version = 20; } else { _mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support."); } @@ -303,14 +302,14 @@ compute_version_es2(struct gl_context *ctx) } /** - * Set the context's VersionMajor, VersionMinor, VersionString fields. + * Set the context's Version and VersionString fields. * This should only be called once as part of context initialization * or to perform version check for GLX_ARB_create_context_profile. */ void _mesa_compute_version(struct gl_context *ctx) { - if (ctx->VersionMajor) + if (ctx->Version) return; switch (ctx->API) { |