aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/version.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/version.c')
-rw-r--r--mesalib/src/mesa/main/version.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 85e623142..59c81aedc 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) {