[Mesa-dev] [PATCH 2/2] mesa: utilize context version routines
Jordan Justen
jordan.l.justen at intel.com
Fri Aug 31 11:52:32 PDT 2012
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +-
src/mesa/main/context.h | 3 ++-
src/mesa/main/enable.c | 4 ++--
src/mesa/main/fbobject.c | 28 ++++++++++++------------
src/mesa/main/get.c | 11 +++++-----
src/mesa/main/glformats.c | 8 +++----
src/mesa/main/points.c | 2 +-
src/mesa/main/readpix.c | 2 +-
src/mesa/main/texformat.c | 4 ++--
src/mesa/main/teximage.c | 14 ++++++------
src/mesa/main/texparam.c | 4 ++--
src/mesa/main/varray.c | 8 +++----
src/mesa/main/version.c | 14 ++++++------
src/mesa/state_tracker/st_manager.c | 2 +-
14 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 4409eae..8cad41e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -97,7 +97,7 @@ nouveau_context_create(gl_api api,
dri_ctx->driverPrivate = ctx;
_mesa_compute_version(ctx);
- if (ctx->Version < major_version * 10 + minor_version) {
+ if (!_mesa_have_version(ctx, major_version, minor_version)) {
nouveau_context_destroy(dri_ctx);
*error = __DRI_CTX_ERROR_BAD_VERSION;
return GL_FALSE;
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index e238752..7c2261a 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -51,6 +51,7 @@
#include "imports.h"
#include "mtypes.h"
+#include "version.h"
#ifdef __cplusplus
@@ -316,7 +317,7 @@ _mesa_is_gles(const struct gl_context *ctx)
static inline GLboolean
_mesa_is_gles3(const struct gl_context *ctx)
{
- return ctx->API == API_OPENGLES2 && ctx->Version >= 30;
+ return ctx->API == API_OPENGLES2 && _mesa_have_version(ctx, 3, 0);
}
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b713f5f..00852ad 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1041,7 +1041,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
* GL_PRIMITIVE_RESTART_NV (which is client state).
*/
case GL_PRIMITIVE_RESTART:
- if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 31) {
+ if (!_mesa_is_desktop_gl(ctx) || !_mesa_have_version(ctx, 3, 1)) {
goto invalid_enum_error;
}
if (ctx->Array.PrimitiveRestart != state) {
@@ -1711,7 +1711,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL 3.1 primitive restart */
case GL_PRIMITIVE_RESTART:
- if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 31) {
+ if (!_mesa_is_desktop_gl(ctx) || !_mesa_have_version(ctx, 3,1)) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 59a5ec3..1f34f49 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1148,11 +1148,11 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return ctx->Extensions.EXT_packed_depth_stencil
? GL_DEPTH_STENCIL_EXT : 0;
case GL_DEPTH_COMPONENT32F:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
? GL_DEPTH_COMPONENT : 0;
case GL_DEPTH32F_STENCIL8:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
? GL_DEPTH_STENCIL : 0;
case GL_RED:
@@ -1171,7 +1171,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RG : 0;
/* signed normalized texture formats */
case GL_R8_SNORM:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
? GL_RED : 0;
case GL_RED_SNORM:
@@ -1179,7 +1179,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RED : 0;
case GL_RG8_SNORM:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
? GL_RG : 0;
case GL_RG_SNORM:
@@ -1187,7 +1187,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RG : 0;
case GL_RGB8_SNORM:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
? GL_RGB : 0;
case GL_RGB_SNORM:
@@ -1195,7 +1195,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
? GL_RGB : 0;
case GL_RGBA8_SNORM:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
? GL_RGBA : 0;
case GL_RGBA_SNORM:
@@ -1228,13 +1228,13 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_R16F:
case GL_R32F:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
case GL_RG16F:
case GL_RG32F:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (ctx->API == API_OPENGL &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
@@ -1282,7 +1282,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGBA8I_EXT:
case GL_RGBA16I_EXT:
case GL_RGBA32I_EXT:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.EXT_texture_integer) ? GL_RGBA : 0;
@@ -1292,7 +1292,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
@@ -1302,7 +1302,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_R16I:
case GL_R32UI:
case GL_R32I:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
@@ -1313,7 +1313,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RG16I:
case GL_RG32UI:
case GL_RG32I:
- return ctx->Version >= 30
+ return _mesa_have_version(ctx, 3, 0)
|| (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
@@ -2214,7 +2214,7 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
error = !ctx->Extensions.ARB_texture_cube_map;
break;
case GL_TEXTURE_2D_ARRAY:
- error = (_mesa_is_gles(ctx) && ctx->Version < 30)
+ error = (_mesa_is_gles(ctx) && !_mesa_have_version(ctx, 3, 0))
|| !ctx->Extensions.EXT_texture_array;
break;
default:
@@ -2608,7 +2608,7 @@ _mesa_GenerateMipmapEXT(GLenum target)
error = _mesa_is_gles(ctx) || !ctx->Extensions.EXT_texture_array;
break;
case GL_TEXTURE_2D_ARRAY:
- error = (_mesa_is_gles(ctx) && ctx->Version < 30)
+ error = (_mesa_is_gles(ctx) && !_mesa_have_version(ctx, 3, 0))
|| !ctx->Extensions.EXT_texture_array;
break;
default:
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index fe1035b..619ffc8 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1491,10 +1491,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
switch (d->pname) {
case GL_MAJOR_VERSION:
- v->value_int = ctx->Version / 10;
+ v->value_int = _mesa_get_version_major(ctx);
break;
case GL_MINOR_VERSION:
- v->value_int = ctx->Version % 10;
+ v->value_int = _mesa_get_version_minor(ctx);
break;
case GL_TEXTURE_1D:
@@ -1859,7 +1859,6 @@ 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->Version;
int total, enabled;
const int *e;
@@ -1868,19 +1867,19 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
for (e = d->extra; *e != EXTRA_END; e++)
switch (*e) {
case EXTRA_VERSION_30:
- if (version >= 30) {
+ if (_mesa_have_version(ctx, 3, 0)) {
total++;
enabled++;
}
break;
case EXTRA_VERSION_31:
- if (version >= 31) {
+ if (_mesa_have_version(ctx, 3, 1)) {
total++;
enabled++;
}
break;
case EXTRA_VERSION_32:
- if (version >= 32) {
+ if (_mesa_have_version(ctx, 3, 2)) {
total++;
enabled++;
}
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 2d06cb7..e2ffc60 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1284,7 +1284,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->Version >= 30 ||
+ return (_mesa_have_version(ctx, 3, 0) ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
@@ -1299,7 +1299,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->Version >= 30 ||
+ return (_mesa_have_version(ctx, 3, 0) ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_BYTE_3_3_2:
@@ -1321,7 +1321,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
/* NOTE: no packed formats w/ BGR format */
- return (ctx->Version >= 30 ||
+ return (_mesa_have_version(ctx, 3, 0) ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
@@ -1337,7 +1337,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->Version >= 30 ||
+ return (_mesa_have_version(ctx, 3, 0) ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_SHORT_4_4_4_4:
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index 538f3cf..df38c86 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -193,7 +193,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
/* GL_POINT_SPRITE_COORD_ORIGIN was added to point sprites when the
* extension was merged into OpenGL 2.0.
*/
- if ((ctx->API == API_OPENGL && ctx->Version >= 20)
+ if ((ctx->API == API_OPENGL && _mesa_have_version(ctx, 2, 0))
|| ctx->API == API_OPENGL_CORE) {
GLenum value = (GLenum) params[0];
if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 7dc7581..39f7a58 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -713,7 +713,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
* preferred combination. This code doesn't know what that preferred
* combination is, and Mesa can handle anything valid. Just work instead.
*/
- if (_mesa_is_gles(ctx) && ctx->Version < 30) {
+ if (_mesa_is_gles(ctx) && !_mesa_have_version(ctx, 3, 0)) {
err = _mesa_es_error_check_format_and_type(format, type, 2);
if (err == GL_NO_ERROR) {
if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 1a318ab..6cb6066 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -731,7 +731,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
}
}
- if (ctx->Version >= 30 ||
+ if (_mesa_have_version(ctx, 3, 0) ||
ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
case GL_RGB8UI_EXT:
@@ -852,7 +852,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
}
}
- if (ctx->Version >= 30 ||
+ if (_mesa_have_version(ctx, 3, 0) ||
(ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.EXT_texture_integer)) {
switch (internalFormat) {
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 11b1b30..59315d1 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -340,7 +340,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
#endif /* FEATURE_EXT_texture_sRGB */
- if (ctx->Version >= 30 ||
+ if (_mesa_have_version(ctx, 3, 0) ||
ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
case GL_RGBA8UI_EXT:
@@ -414,7 +414,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_R16UI:
case GL_R32I:
case GL_R32UI:
- if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
+ if (!_mesa_have_version(ctx, 3, 0) && !ctx->Extensions.EXT_texture_integer)
break;
/* FALLTHROUGH */
case GL_R8:
@@ -439,7 +439,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_RG16UI:
case GL_RG32I:
case GL_RG32UI:
- if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
+ if (!_mesa_have_version(ctx, 3, 0) && !ctx->Extensions.EXT_texture_integer)
break;
/* FALLTHROUGH */
case GL_RG:
@@ -1867,7 +1867,7 @@ texture_error_check( struct gl_context *ctx,
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
- (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))) {
+ (_mesa_have_version(ctx, 3, 0) || ctx->Extensions.EXT_gpu_shader4))) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage%dD(bad target for depth texture)",
dimensions);
@@ -1895,7 +1895,7 @@ texture_error_check( struct gl_context *ctx,
}
/* additional checks for integer textures */
- if ((ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) &&
+ if ((_mesa_have_version(ctx, 3, 0) || ctx->Extensions.EXT_texture_integer) &&
(_mesa_is_enum_format_integer(format) !=
_mesa_is_enum_format_integer(internalFormat))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2264,7 +2264,7 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
}
}
- if (ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) {
+ if (_mesa_have_version(ctx, 3, 0) || ctx->Extensions.EXT_texture_integer) {
/* both source and dest must be integer-valued, or neither */
if (_mesa_is_format_integer_color(destTex->TexFormat) !=
_mesa_is_enum_format_integer(format)) {
@@ -3988,7 +3988,7 @@ validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
* any mention of R/RG formats, but they appear in the GL 3.1 core
* specification.
*/
- if (ctx->Version <= 30) {
+ if (!_mesa_have_version(ctx, 3, 1)) {
GLenum base_format = _mesa_get_format_base_format(format);
if (base_format == GL_R || base_format == GL_RG)
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index e6140eb..6f1ceb8 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -977,7 +977,7 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target)
* From the OpenGL 3.1 spec:
* "target may also be TEXTURE_BUFFER, indicating the texture buffer."
*/
- return _mesa_is_desktop_gl(ctx) && ctx->Version >= 31;
+ return _mesa_is_desktop_gl(ctx) && _mesa_have_version(ctx, 3, 1);
default:
return GL_FALSE;
}
@@ -1079,7 +1079,7 @@ get_tex_level_parameter_image(struct gl_context *ctx,
*params = _mesa_get_format_bits(texFormat, pname);
break;
case GL_TEXTURE_SHARED_SIZE:
- if (ctx->Version < 30 &&
+ if (!_mesa_have_version(ctx, 3, 0) &&
!ctx->Extensions.EXT_texture_shared_exponent)
goto invalid_pname;
*params = texFormat == MESA_FORMAT_RGB9_E5_FLOAT ? 5 : 0;
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 91452b7..724c545 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -161,7 +161,7 @@ update_array(struct gl_context *ctx,
* 3.0. The 2_10_10_10 types are added in OpenGL ES 3.0 or
* GL_OES_vertex_type_10_10_10_2.
*/
- if (ctx->Version < 30) {
+ if (!_mesa_have_version(ctx, 3, 0)) {
legalTypesMask &= ~(UNSIGNED_INT_BIT
| INT_BIT
| UNSIGNED_INT_2_10_10_10_REV_BIT
@@ -617,7 +617,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
return array->BufferObj->Name;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
if ((_mesa_is_desktop_gl(ctx)
- && (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))
+ && (_mesa_have_version(ctx, 3, 0) || ctx->Extensions.EXT_gpu_shader4))
|| _mesa_is_gles3(ctx)) {
return array->Integer;
}
@@ -647,7 +647,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function)
* that will erroneously allow this usage in a 3.0 forward-compatible
* context too.
*/
- if ((ctx->API != API_OPENGL_CORE || ctx->Version < 31)
+ if ((ctx->API != API_OPENGL_CORE || !_mesa_have_version(ctx, 3, 1))
&& ctx->API != API_OPENGLES2) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(index==0)", function);
return NULL;
@@ -1149,7 +1149,7 @@ _mesa_PrimitiveRestartIndex(GLuint index)
{
GET_CURRENT_CONTEXT(ctx);
- if (!ctx->Extensions.NV_primitive_restart && ctx->Version < 31) {
+ if (!ctx->Extensions.NV_primitive_restart && !_mesa_have_version(ctx, 3, 1)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
return;
}
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index f22118a..512a9d7 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -51,7 +51,7 @@ override_version(struct gl_context *ctx)
return;
}
- ctx->Version = major * 10 + minor;
+ _mesa_set_version(ctx, major, minor);
}
/**
@@ -220,7 +220,7 @@ compute_version(struct gl_context *ctx)
minor = 2;
}
- ctx->Version = major * 10 + minor;
+ _mesa_set_version(ctx, major, minor);
override_version(ctx);
@@ -232,7 +232,7 @@ compute_version(struct gl_context *ctx)
" (" MESA_GIT_SHA1 ")"
#endif
,
- ctx->Version / 10, ctx->Version % 10);
+ major, minor);
}
}
@@ -249,9 +249,9 @@ compute_version_es1(struct gl_context *ctx)
ctx->Extensions.EXT_point_parameters);
if (ver_1_1) {
- ctx->Version = 11;
+ _mesa_set_version(ctx, 1, 1);
} else if (ver_1_0) {
- ctx->Version = 10;
+ _mesa_set_version(ctx, 1, 0);
} else {
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
}
@@ -264,7 +264,7 @@ compute_version_es1(struct gl_context *ctx)
" (" MESA_GIT_SHA1 ")"
#endif
,
- ctx->Version % 10);
+ _mesa_get_version_minor(ctx));
}
}
@@ -284,7 +284,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->Version = 20;
+ _mesa_set_version(ctx, 2, 0);
} else {
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
}
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index df73d0e..b88f403 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -652,7 +652,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
* yet enforce the added restrictions of a forward-looking context, so
* fail that too.
*/
- if (st->ctx->Version < attribs->major * 10 + attribs->minor
+ if (!_mesa_have_version(st->ctx, attribs->major, attribs->minor)
|| (attribs->flags & ~ST_CONTEXT_FLAG_DEBUG) != 0) {
*error = ST_CONTEXT_ERROR_BAD_VERSION;
st_destroy_context(st);
--
1.7.9.5
More information about the mesa-dev
mailing list