goto invalid_enum_error; \
}
+/*
+ * Check GL version.
+ */
+#define CHECK_VERSION(VERSION) \
+ if (version < VERSION) { \
+ goto invalid_enum_error; \
+ }
+
void GLAPIENTRY
_mesa_GetBooleanv( GLenum pname, GLboolean *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateComponents);
break;
case GL_NUM_EXTENSIONS:
+ CHECK_VERSION(30);
params[0] = INT_TO_BOOLEAN(_mesa_get_extension_count(ctx));
break;
case GL_MAJOR_VERSION:
+ CHECK_VERSION(30);
params[0] = INT_TO_BOOLEAN(ctx->VersionMajor);
break;
case GL_MINOR_VERSION:
+ CHECK_VERSION(30);
params[0] = INT_TO_BOOLEAN(ctx->VersionMinor);
break;
case GL_CONTEXT_FLAGS:
+ CHECK_VERSION(30);
params[0] = INT_TO_BOOLEAN(ctx->Const.ContextFlags);
break;
case GL_PRIMITIVE_RESTART:
+ CHECK_VERSION(31);
params[0] = ctx->Array.PrimitiveRestart;
break;
case GL_PRIMITIVE_RESTART_INDEX:
+ CHECK_VERSION(31);
params[0] = INT_TO_BOOLEAN(ctx->Array.RestartIndex);
break;
case GL_CONTEXT_PROFILE_MASK:
+ CHECK_VERSION(32);
params[0] = INT_TO_BOOLEAN(ctx->Const.ProfileMask);
break;
default:
_mesa_GetFloatv( GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateComponents);
break;
case GL_NUM_EXTENSIONS:
+ CHECK_VERSION(30);
params[0] = (GLfloat)(_mesa_get_extension_count(ctx));
break;
case GL_MAJOR_VERSION:
+ CHECK_VERSION(30);
params[0] = (GLfloat)(ctx->VersionMajor);
break;
case GL_MINOR_VERSION:
+ CHECK_VERSION(30);
params[0] = (GLfloat)(ctx->VersionMinor);
break;
case GL_CONTEXT_FLAGS:
+ CHECK_VERSION(30);
params[0] = (GLfloat)(ctx->Const.ContextFlags);
break;
case GL_PRIMITIVE_RESTART:
+ CHECK_VERSION(31);
params[0] = BOOLEAN_TO_FLOAT(ctx->Array.PrimitiveRestart);
break;
case GL_PRIMITIVE_RESTART_INDEX:
+ CHECK_VERSION(31);
params[0] = (GLfloat)(ctx->Array.RestartIndex);
break;
case GL_CONTEXT_PROFILE_MASK:
+ CHECK_VERSION(32);
params[0] = (GLfloat)(ctx->Const.ProfileMask);
break;
default:
_mesa_GetIntegerv( GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
params[0] = ctx->Const.MaxTransformFeedbackSeparateComponents;
break;
case GL_NUM_EXTENSIONS:
+ CHECK_VERSION(30);
params[0] = _mesa_get_extension_count(ctx);
break;
case GL_MAJOR_VERSION:
+ CHECK_VERSION(30);
params[0] = ctx->VersionMajor;
break;
case GL_MINOR_VERSION:
+ CHECK_VERSION(30);
params[0] = ctx->VersionMinor;
break;
case GL_CONTEXT_FLAGS:
+ CHECK_VERSION(30);
params[0] = ctx->Const.ContextFlags;
break;
case GL_PRIMITIVE_RESTART:
+ CHECK_VERSION(31);
params[0] = BOOLEAN_TO_INT(ctx->Array.PrimitiveRestart);
break;
case GL_PRIMITIVE_RESTART_INDEX:
+ CHECK_VERSION(31);
params[0] = ctx->Array.RestartIndex;
break;
case GL_CONTEXT_PROFILE_MASK:
+ CHECK_VERSION(32);
params[0] = ctx->Const.ProfileMask;
break;
default:
_mesa_GetInteger64v( GLenum pname, GLint64 *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateComponents);
break;
case GL_NUM_EXTENSIONS:
+ CHECK_VERSION(30);
params[0] = (GLint64)(_mesa_get_extension_count(ctx));
break;
case GL_MAJOR_VERSION:
+ CHECK_VERSION(30);
params[0] = (GLint64)(ctx->VersionMajor);
break;
case GL_MINOR_VERSION:
+ CHECK_VERSION(30);
params[0] = (GLint64)(ctx->VersionMinor);
break;
case GL_CONTEXT_FLAGS:
+ CHECK_VERSION(30);
params[0] = (GLint64)(ctx->Const.ContextFlags);
break;
case GL_PRIMITIVE_RESTART:
+ CHECK_VERSION(31);
params[0] = BOOLEAN_TO_INT64(ctx->Array.PrimitiveRestart);
break;
case GL_PRIMITIVE_RESTART_INDEX:
+ CHECK_VERSION(31);
params[0] = (GLint64)(ctx->Array.RestartIndex);
break;
case GL_CONTEXT_PROFILE_MASK:
+ CHECK_VERSION(32);
params[0] = (GLint64)(ctx->Const.ProfileMask);
break;
default:
_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
_mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
{
GET_CURRENT_CONTEXT(ctx);
+ const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ (void) version;
if (!params)
return;
NoState, ["EXT_transform_feedback"] ),
# GL 3.0
- ( "GL_NUM_EXTENSIONS", GLint, ["_mesa_get_extension_count(ctx)"], "", NoState, NoExt ),
- ( "GL_MAJOR_VERSION", GLint, ["ctx->VersionMajor"], "", NoState, NoExt ),
- ( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", NoState, NoExt ),
- ( "GL_CONTEXT_FLAGS", GLint, ["ctx->Const.ContextFlags"], "", NoState, NoExt ),
+ ( "GL_NUM_EXTENSIONS", GLint,
+ ["_mesa_get_extension_count(ctx)"], "", NoState, "30" ),
+ ( "GL_MAJOR_VERSION", GLint,
+ ["ctx->VersionMajor"], "", NoState, "30" ),
+ ( "GL_MINOR_VERSION", GLint,
+ ["ctx->VersionMinor"], "", NoState, "30" ),
+ ( "GL_CONTEXT_FLAGS", GLint,
+ ["ctx->Const.ContextFlags"], "", NoState, "30" ),
# GL 3.1
( "GL_PRIMITIVE_RESTART", GLboolean,
- ["ctx->Array.PrimitiveRestart"], "", NoState, NoExt ),
+ ["ctx->Array.PrimitiveRestart"], "", NoState, "31" ),
( "GL_PRIMITIVE_RESTART_INDEX", GLint,
- ["ctx->Array.RestartIndex"], "", NoState, NoExt ),
+ ["ctx->Array.RestartIndex"], "", NoState, "31" ),
# GL 3.2
( "GL_CONTEXT_PROFILE_MASK", GLint, ["ctx->Const.ProfileMask"], "",
- NoState, NoExt )
+ NoState, "32" )
]
print "_mesa_%s( GLenum pname, %s *params )" % (function, strType)
print "{"
print " GET_CURRENT_CONTEXT(ctx);"
+ print " const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;"
print " ASSERT_OUTSIDE_BEGIN_END(ctx);"
+ print " (void) version;"
print ""
print " if (!params)"
print " return;"
# Do extension check
if extensions:
- if len(extensions) == 1:
+ if extensions == "30" or extensions == "31" or extensions == "32":
+ print (' CHECK_VERSION(%s);' % extensions)
+ elif len(extensions) == 1:
print (' CHECK_EXT1(%s);' % extensions[0])
elif len(extensions) == 2:
print (' CHECK_EXT2(%s, %s);' % (extensions[0], extensions[1]))
goto invalid_enum_error; \\
}
+/*
+ * Check GL version.
+ */
+#define CHECK_VERSION(VERSION) \\
+ if (version < VERSION) { \\
+ goto invalid_enum_error; \\
+ }
+
"""
return