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 <kenneth@whitecape.org>
This commit is contained in:
@@ -724,9 +724,7 @@ intelCreateContext(gl_api api,
|
|||||||
(struct gl_context *) driContextPriv->driverPrivate;
|
(struct gl_context *) driContextPriv->driverPrivate;
|
||||||
|
|
||||||
_mesa_compute_version(ctx);
|
_mesa_compute_version(ctx);
|
||||||
if (ctx->VersionMajor > major_version
|
if (ctx->Version >= major_version * 10 + minor_version) {
|
||||||
|| (ctx->VersionMajor == major_version
|
|
||||||
&& ctx->VersionMinor >= minor_version)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,9 +75,7 @@ nouveau_context_create(gl_api api,
|
|||||||
dri_ctx->driverPrivate = ctx;
|
dri_ctx->driverPrivate = ctx;
|
||||||
|
|
||||||
_mesa_compute_version(ctx);
|
_mesa_compute_version(ctx);
|
||||||
if (ctx->VersionMajor < major_version
|
if (ctx->Version < major_version * 10 + minor_version) {
|
||||||
|| (ctx->VersionMajor == major_version
|
|
||||||
&& ctx->VersionMinor < minor_version)) {
|
|
||||||
nouveau_context_destroy(dri_ctx);
|
nouveau_context_destroy(dri_ctx);
|
||||||
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -454,9 +454,7 @@ GLboolean r200CreateContext( gl_api api,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mesa_compute_version(ctx);
|
_mesa_compute_version(ctx);
|
||||||
if (ctx->VersionMajor < major_version
|
if (ctx->Version < major_version * 10 + minor_version) {
|
||||||
|| (ctx->VersionMajor == major_version
|
|
||||||
&& ctx->VersionMinor < minor_version)) {
|
|
||||||
r200DestroyContext(driContextPriv);
|
r200DestroyContext(driContextPriv);
|
||||||
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -402,9 +402,7 @@ r100CreateContext( gl_api api,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mesa_compute_version(ctx);
|
_mesa_compute_version(ctx);
|
||||||
if (ctx->VersionMajor < major_version
|
if (ctx->Version < major_version * 10 + minor_version) {
|
||||||
|| (ctx->VersionMajor == major_version
|
|
||||||
&& ctx->VersionMinor < minor_version)) {
|
|
||||||
radeonDestroyContext(driContextPriv);
|
radeonDestroyContext(driContextPriv);
|
||||||
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -902,7 +902,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
|||||||
* GL_PRIMITIVE_RESTART_NV (which is client state).
|
* GL_PRIMITIVE_RESTART_NV (which is client state).
|
||||||
*/
|
*/
|
||||||
case GL_PRIMITIVE_RESTART:
|
case GL_PRIMITIVE_RESTART:
|
||||||
if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
|
if (ctx->Version < 31) {
|
||||||
goto invalid_enum_error;
|
goto invalid_enum_error;
|
||||||
}
|
}
|
||||||
if (ctx->Array.PrimitiveRestart != state) {
|
if (ctx->Array.PrimitiveRestart != state) {
|
||||||
@@ -1419,7 +1419,7 @@ _mesa_IsEnabled( GLenum cap )
|
|||||||
|
|
||||||
/* GL 3.1 primitive restart */
|
/* GL 3.1 primitive restart */
|
||||||
case GL_PRIMITIVE_RESTART:
|
case GL_PRIMITIVE_RESTART:
|
||||||
if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
|
if (ctx->Version < 31) {
|
||||||
goto invalid_enum_error;
|
goto invalid_enum_error;
|
||||||
}
|
}
|
||||||
return ctx->Array.PrimitiveRestart;
|
return ctx->Array.PrimitiveRestart;
|
||||||
|
@@ -1226,7 +1226,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
|||||||
case GL_RGBA8I_EXT:
|
case GL_RGBA8I_EXT:
|
||||||
case GL_RGBA16I_EXT:
|
case GL_RGBA16I_EXT:
|
||||||
case GL_RGBA32I_EXT:
|
case GL_RGBA32I_EXT:
|
||||||
return ctx->VersionMajor >= 3 ||
|
return ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
|
ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
|
||||||
|
|
||||||
case GL_RGB8UI_EXT:
|
case GL_RGB8UI_EXT:
|
||||||
@@ -1235,7 +1235,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
|||||||
case GL_RGB8I_EXT:
|
case GL_RGB8I_EXT:
|
||||||
case GL_RGB16I_EXT:
|
case GL_RGB16I_EXT:
|
||||||
case GL_RGB32I_EXT:
|
case GL_RGB32I_EXT:
|
||||||
return ctx->VersionMajor >= 3 ||
|
return ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
|
ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
|
||||||
|
|
||||||
case GL_R8UI:
|
case GL_R8UI:
|
||||||
@@ -1244,7 +1244,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
|||||||
case GL_R16I:
|
case GL_R16I:
|
||||||
case GL_R32UI:
|
case GL_R32UI:
|
||||||
case GL_R32I:
|
case GL_R32I:
|
||||||
return ctx->VersionMajor >= 3 ||
|
return ctx->Version >= 30 ||
|
||||||
(ctx->Extensions.ARB_texture_rg &&
|
(ctx->Extensions.ARB_texture_rg &&
|
||||||
ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
|
ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
|
||||||
|
|
||||||
@@ -1254,7 +1254,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
|||||||
case GL_RG16I:
|
case GL_RG16I:
|
||||||
case GL_RG32UI:
|
case GL_RG32UI:
|
||||||
case GL_RG32I:
|
case GL_RG32I:
|
||||||
return ctx->VersionMajor >= 3 ||
|
return ctx->Version >= 30 ||
|
||||||
(ctx->Extensions.ARB_texture_rg &&
|
(ctx->Extensions.ARB_texture_rg &&
|
||||||
ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
|
ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
|
||||||
|
|
||||||
|
@@ -1303,8 +1303,8 @@ static const struct value_desc values[] = {
|
|||||||
|
|
||||||
/* GL 3.0 */
|
/* GL 3.0 */
|
||||||
{ GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
|
{ GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
|
||||||
{ GL_MAJOR_VERSION, CONTEXT_INT(VersionMajor), extra_version_30 },
|
{ GL_MAJOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
|
||||||
{ GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 },
|
{ GL_MINOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
|
||||||
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
|
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
|
||||||
|
|
||||||
/* GL3.0 / GL_EXT_framebuffer_sRGB */
|
/* 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;
|
GLuint unit, *p;
|
||||||
|
|
||||||
switch (d->pname) {
|
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_1D:
|
||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
@@ -1848,7 +1855,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
|||||||
static GLboolean
|
static GLboolean
|
||||||
check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d)
|
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;
|
int total, enabled;
|
||||||
const int *e;
|
const int *e;
|
||||||
|
|
||||||
|
@@ -1237,7 +1237,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||||||
case GL_UNSIGNED_SHORT:
|
case GL_UNSIGNED_SHORT:
|
||||||
case GL_INT:
|
case GL_INT:
|
||||||
case GL_UNSIGNED_INT:
|
case GL_UNSIGNED_INT:
|
||||||
return (ctx->VersionMajor >= 3 ||
|
return (ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer)
|
ctx->Extensions.EXT_texture_integer)
|
||||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||||
default:
|
default:
|
||||||
@@ -1252,7 +1252,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||||||
case GL_UNSIGNED_SHORT:
|
case GL_UNSIGNED_SHORT:
|
||||||
case GL_INT:
|
case GL_INT:
|
||||||
case GL_UNSIGNED_INT:
|
case GL_UNSIGNED_INT:
|
||||||
return (ctx->VersionMajor >= 3 ||
|
return (ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer)
|
ctx->Extensions.EXT_texture_integer)
|
||||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||||
case GL_UNSIGNED_BYTE_3_3_2:
|
case GL_UNSIGNED_BYTE_3_3_2:
|
||||||
@@ -1274,7 +1274,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||||||
case GL_INT:
|
case GL_INT:
|
||||||
case GL_UNSIGNED_INT:
|
case GL_UNSIGNED_INT:
|
||||||
/* NOTE: no packed formats w/ BGR format */
|
/* NOTE: no packed formats w/ BGR format */
|
||||||
return (ctx->VersionMajor >= 3 ||
|
return (ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer)
|
ctx->Extensions.EXT_texture_integer)
|
||||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||||
default:
|
default:
|
||||||
@@ -1290,7 +1290,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||||||
case GL_UNSIGNED_SHORT:
|
case GL_UNSIGNED_SHORT:
|
||||||
case GL_INT:
|
case GL_INT:
|
||||||
case GL_UNSIGNED_INT:
|
case GL_UNSIGNED_INT:
|
||||||
return (ctx->VersionMajor >= 3 ||
|
return (ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer)
|
ctx->Extensions.EXT_texture_integer)
|
||||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||||
case GL_UNSIGNED_SHORT_4_4_4_4:
|
case GL_UNSIGNED_SHORT_4_4_4_4:
|
||||||
|
@@ -3424,8 +3424,8 @@ struct gl_context
|
|||||||
/** Extension information */
|
/** Extension information */
|
||||||
struct gl_extensions Extensions;
|
struct gl_extensions Extensions;
|
||||||
|
|
||||||
/** Version info */
|
/** GL version integer, for example 31 for GL 3.1, or 20 for GLES 2.0. */
|
||||||
GLuint VersionMajor, VersionMinor;
|
GLuint Version;
|
||||||
char *VersionString;
|
char *VersionString;
|
||||||
|
|
||||||
/** \name State attribute stack (for glPush/PopAttrib) */
|
/** \name State attribute stack (for glPush/PopAttrib) */
|
||||||
|
@@ -719,7 +719,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->VersionMajor >= 3 ||
|
if (ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer) {
|
ctx->Extensions.EXT_texture_integer) {
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
case GL_RGB8UI_EXT:
|
case GL_RGB8UI_EXT:
|
||||||
@@ -838,7 +838,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->VersionMajor >= 3 ||
|
if (ctx->Version >= 30 ||
|
||||||
(ctx->Extensions.ARB_texture_rg &&
|
(ctx->Extensions.ARB_texture_rg &&
|
||||||
ctx->Extensions.EXT_texture_integer)) {
|
ctx->Extensions.EXT_texture_integer)) {
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
|
@@ -332,7 +332,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
|
|||||||
}
|
}
|
||||||
#endif /* FEATURE_EXT_texture_sRGB */
|
#endif /* FEATURE_EXT_texture_sRGB */
|
||||||
|
|
||||||
if (ctx->VersionMajor >= 3 ||
|
if (ctx->Version >= 30 ||
|
||||||
ctx->Extensions.EXT_texture_integer) {
|
ctx->Extensions.EXT_texture_integer) {
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
case GL_RGBA8UI_EXT:
|
case GL_RGBA8UI_EXT:
|
||||||
@@ -406,7 +406,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
|
|||||||
case GL_R16UI:
|
case GL_R16UI:
|
||||||
case GL_R32I:
|
case GL_R32I:
|
||||||
case GL_R32UI:
|
case GL_R32UI:
|
||||||
if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
|
if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
|
||||||
break;
|
break;
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case GL_R8:
|
case GL_R8:
|
||||||
@@ -431,7 +431,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
|
|||||||
case GL_RG16UI:
|
case GL_RG16UI:
|
||||||
case GL_RG32I:
|
case GL_RG32I:
|
||||||
case GL_RG32UI:
|
case GL_RG32UI:
|
||||||
if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
|
if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
|
||||||
break;
|
break;
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case GL_RG:
|
case GL_RG:
|
||||||
@@ -1732,7 +1732,7 @@ texture_error_check( struct gl_context *ctx,
|
|||||||
target != GL_TEXTURE_RECTANGLE_ARB &&
|
target != GL_TEXTURE_RECTANGLE_ARB &&
|
||||||
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
|
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
|
||||||
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
|
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
|
||||||
(ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4))) {
|
(ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))) {
|
||||||
if (!isProxy)
|
if (!isProxy)
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glTexImage(target/internalFormat)");
|
"glTexImage(target/internalFormat)");
|
||||||
@@ -1764,7 +1764,7 @@ texture_error_check( struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* additional checks for integer textures */
|
/* additional checks for integer textures */
|
||||||
if ((ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) &&
|
if ((ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) &&
|
||||||
(_mesa_is_enum_format_integer(format) !=
|
(_mesa_is_enum_format_integer(format) !=
|
||||||
_mesa_is_enum_format_integer(internalFormat))) {
|
_mesa_is_enum_format_integer(internalFormat))) {
|
||||||
if (!isProxy) {
|
if (!isProxy) {
|
||||||
@@ -1937,7 +1937,7 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
|
if (ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) {
|
||||||
/* both source and dest must be integer-valued, or neither */
|
/* both source and dest must be integer-valued, or neither */
|
||||||
if (_mesa_is_format_integer_color(destTex->TexFormat) !=
|
if (_mesa_is_format_integer_color(destTex->TexFormat) !=
|
||||||
_mesa_is_enum_format_integer(format)) {
|
_mesa_is_enum_format_integer(format)) {
|
||||||
@@ -3860,8 +3860,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
|
* any mention of R/RG formats, but they appear in the GL 3.1 core
|
||||||
* specification.
|
* specification.
|
||||||
*/
|
*/
|
||||||
if (ctx->VersionMajor < 3 ||
|
if (ctx->Version <= 30) {
|
||||||
(ctx->VersionMajor == 3 && ctx->VersionMinor == 0)) {
|
|
||||||
GLenum base_format = _mesa_get_format_base_format(format);
|
GLenum base_format = _mesa_get_format_base_format(format);
|
||||||
|
|
||||||
if (base_format == GL_R || base_format == GL_RG)
|
if (base_format == GL_R || base_format == GL_RG)
|
||||||
|
@@ -1016,7 +1016,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||||||
*params = _mesa_get_format_bits(texFormat, pname);
|
*params = _mesa_get_format_bits(texFormat, pname);
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_SHARED_SIZE:
|
case GL_TEXTURE_SHARED_SIZE:
|
||||||
if (ctx->VersionMajor < 3 &&
|
if (ctx->Version < 30 &&
|
||||||
!ctx->Extensions.EXT_texture_shared_exponent)
|
!ctx->Extensions.EXT_texture_shared_exponent)
|
||||||
goto invalid_pname;
|
goto invalid_pname;
|
||||||
*params = texFormat == MESA_FORMAT_RGB9_E5_FLOAT ? 5 : 0;
|
*params = texFormat == MESA_FORMAT_RGB9_E5_FLOAT ? 5 : 0;
|
||||||
|
@@ -568,7 +568,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
|
|||||||
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
|
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
|
||||||
return array->BufferObj->Name;
|
return array->BufferObj->Name;
|
||||||
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
|
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
|
||||||
if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4) {
|
if (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4) {
|
||||||
return array->Integer;
|
return array->Integer;
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1092,8 +1092,7 @@ _mesa_PrimitiveRestartIndex(GLuint index)
|
|||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
if (!ctx->Extensions.NV_primitive_restart &&
|
if (!ctx->Extensions.NV_primitive_restart && ctx->Version < 31) {
|
||||||
ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -33,22 +33,25 @@
|
|||||||
* are point-separated version numbers, such as "3.0".
|
* are point-separated version numbers, such as "3.0".
|
||||||
*/
|
*/
|
||||||
static void
|
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 *env_var = "MESA_GL_VERSION_OVERRIDE";
|
||||||
const char *version;
|
const char *version;
|
||||||
int n;
|
int n;
|
||||||
|
int major, minor;
|
||||||
|
|
||||||
version = getenv(env_var);
|
version = getenv(env_var);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = sscanf(version, "%u.%u", major, minor);
|
n = sscanf(version, "%u.%u", &major, &minor);
|
||||||
if (n != 2) {
|
if (n != 2) {
|
||||||
fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
|
fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->Version = major * 10 + minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,10 +221,9 @@ compute_version(struct gl_context *ctx)
|
|||||||
minor = 2;
|
minor = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->VersionMajor = major;
|
ctx->Version = major * 10 + minor;
|
||||||
ctx->VersionMinor = minor;
|
|
||||||
|
|
||||||
override_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
|
override_version(ctx);
|
||||||
|
|
||||||
ctx->VersionString = (char *) malloc(max);
|
ctx->VersionString = (char *) malloc(max);
|
||||||
if (ctx->VersionString) {
|
if (ctx->VersionString) {
|
||||||
@@ -231,7 +233,7 @@ compute_version(struct gl_context *ctx)
|
|||||||
" (" MESA_GIT_SHA1 ")"
|
" (" MESA_GIT_SHA1 ")"
|
||||||
#endif
|
#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);
|
ctx->Extensions.EXT_point_parameters);
|
||||||
|
|
||||||
if (ver_1_1) {
|
if (ver_1_1) {
|
||||||
ctx->VersionMajor = 1;
|
ctx->Version = 11;
|
||||||
ctx->VersionMinor = 1;
|
|
||||||
} else if (ver_1_0) {
|
} else if (ver_1_0) {
|
||||||
ctx->VersionMajor = 1;
|
ctx->Version = 10;
|
||||||
ctx->VersionMinor = 0;
|
|
||||||
} else {
|
} else {
|
||||||
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
|
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ compute_version_es1(struct gl_context *ctx)
|
|||||||
" (" MESA_GIT_SHA1 ")"
|
" (" MESA_GIT_SHA1 ")"
|
||||||
#endif
|
#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.ARB_texture_non_power_of_two &&
|
||||||
ctx->Extensions.EXT_blend_equation_separate);
|
ctx->Extensions.EXT_blend_equation_separate);
|
||||||
if (ver_2_0) {
|
if (ver_2_0) {
|
||||||
ctx->VersionMajor = 2;
|
ctx->Version = 20;
|
||||||
ctx->VersionMinor = 0;
|
|
||||||
} else {
|
} else {
|
||||||
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
|
_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
|
* This should only be called once as part of context initialization
|
||||||
* or to perform version check for GLX_ARB_create_context_profile.
|
* or to perform version check for GLX_ARB_create_context_profile.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_mesa_compute_version(struct gl_context *ctx)
|
_mesa_compute_version(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
if (ctx->VersionMajor)
|
if (ctx->Version)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (ctx->API) {
|
switch (ctx->API) {
|
||||||
|
@@ -652,8 +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
|
* yet enforce the added restrictions of a forward-looking context, so
|
||||||
* fail that too.
|
* fail that too.
|
||||||
*/
|
*/
|
||||||
if (st->ctx->VersionMajor * 10 + st->ctx->VersionMinor <
|
if (st->ctx->Version < attribs->major * 10 + attribs->minor
|
||||||
attribs->major * 10 + attribs->minor
|
|
||||||
|| (attribs->flags & ~ST_CONTEXT_FLAG_DEBUG) != 0) {
|
|| (attribs->flags & ~ST_CONTEXT_FLAG_DEBUG) != 0) {
|
||||||
*error = ST_CONTEXT_ERROR_BAD_VERSION;
|
*error = ST_CONTEXT_ERROR_BAD_VERSION;
|
||||||
st_destroy_context(st);
|
st_destroy_context(st);
|
||||||
|
Reference in New Issue
Block a user