diff options
author | Eric Anholt <[email protected]> | 2012-07-26 14:43:56 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-08-07 11:47:19 -0700 |
commit | 9c1b41879aab2ff7386c547a2ccce7686c018cf5 (patch) | |
tree | 934b03d503f257d3979d6ebe9ad36cee2953bb25 /src/mesa/main/get.c | |
parent | 3aaeb3e5e76b7b468e2eb2a26f30d68d19d3c854 (diff) |
mesa: Replace VersionMajor/VersionMinor with a Version field.
As we get into supporting GL 3.x core, we come across more and more features
of the API that depend on the version number as opposed to just the extension
list. This will let us more sanely do version checks than "(VersionMajor == 3
&& VersionMinor >= 2) || VersionMajor >= 4".
v2: Fix a bad <= 30 check.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 16ad2c4302d..332dfaf7f99 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1303,8 +1303,8 @@ static const struct value_desc values[] = { /* GL 3.0 */ { GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, - { GL_MAJOR_VERSION, CONTEXT_INT(VersionMajor), extra_version_30 }, - { GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 }, + { GL_MAJOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, + { GL_MINOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, { GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 }, /* GL3.0 / GL_EXT_framebuffer_sRGB */ @@ -1486,6 +1486,13 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu GLuint unit, *p; switch (d->pname) { + case GL_MAJOR_VERSION: + v->value_int = ctx->Version / 10; + break; + case GL_MINOR_VERSION: + v->value_int = ctx->Version % 10; + break; + case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: @@ -1848,7 +1855,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu static GLboolean check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d) { - const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; + const GLuint version = ctx->Version; int total, enabled; const int *e; |