summaryrefslogtreecommitdiff
path: root/src/mesa/main/get_gen.py
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-04-20 21:17:35 -0600
committerBrian Paul <brianp@vmware.com>2010-04-20 21:17:35 -0600
commit736a2f2f956c14d52c1ca9291a6dfa5df5e7b062 (patch)
tree67bf5288b585329f30ef841228c92acfc3af1b3c /src/mesa/main/get_gen.py
parenta40e6f220ac7e41126b9815db27d362bda719bf6 (diff)
mesa: do version checking for GL 3.x queries
Diffstat (limited to 'src/mesa/main/get_gen.py')
-rw-r--r--src/mesa/main/get_gen.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 0279ec9d1d..21f7750dbd 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -1140,20 +1140,24 @@ StateVars = [
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" )
]
@@ -1257,7 +1261,9 @@ def EmitGetFunction(stateVars, returnType, indexed):
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;"
@@ -1280,7 +1286,9 @@ def EmitGetFunction(stateVars, returnType, indexed):
# 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]))
@@ -1404,6 +1412,14 @@ def EmitHeader():
goto invalid_enum_error; \\
}
+/*
+ * Check GL version.
+ */
+#define CHECK_VERSION(VERSION) \\
+ if (version < VERSION) { \\
+ goto invalid_enum_error; \\
+ }
+
"""
return