summaryrefslogtreecommitdiffstats
path: root/src/mesa/glapi/gl_apitemp.py
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2009-09-03 11:05:06 +0800
committerBrian Paul <[email protected]>2009-11-06 14:19:23 -0700
commit1af44e9e5a3b522dd083f7e1486146376b01fdff (patch)
tree1756d99b62c1dcf3fb4e439ef9087a4b76cd997f /src/mesa/glapi/gl_apitemp.py
parent5b85cada603ff0325dcf852f159837086a5bda14 (diff)
glapi: Add OpenGL ES compatibility mode to scripts.
When the mode is on, the scripts would generate headers that are suitable for OpenGL ES. There are two differences. One is that they will generate function prototypes for OpenGL ES specific functions. The other is that, when a function has multiple names, SET/GET/CALL macros would be generated for each of names. Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/mesa/glapi/gl_apitemp.py')
-rw-r--r--src/mesa/glapi/gl_apitemp.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py
index d4f8b1d8f85..09b0d364ce3 100644
--- a/src/mesa/glapi/gl_apitemp.py
+++ b/src/mesa/glapi/gl_apitemp.py
@@ -30,7 +30,7 @@ import license
import sys, getopt
class PrintGlOffsets(gl_XML.gl_print_base):
- def __init__(self):
+ def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
self.name = "gl_apitemp.py (from Mesa)"
@@ -38,6 +38,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+ self.es = es
+
self.undef_list.append( "KEYWORD1" )
self.undef_list.append( "KEYWORD1_ALT" )
self.undef_list.append( "KEYWORD2" )
@@ -82,7 +84,14 @@ class PrintGlOffsets(gl_XML.gl_print_base):
else:
dispatch = "DISPATCH"
+ need_proto = False
if not f.is_static_entry_point(name):
+ need_proto = True
+ elif self.es:
+ cat, num = api.get_category_for_name(name)
+ if (cat.startswith("es") or cat.startswith("GL_OES")):
+ need_proto = True
+ if need_proto:
print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.return_type, n, f.get_parameter_string(name))
print ''
@@ -286,22 +295,26 @@ static _glapi_proc UNUSED_TABLE_NAME[] = {"""
def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0]
+ print "-c Enable compatibility with OpenGL ES."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:c")
except Exception,e:
show_usage()
+ es = False
for (arg,val) in args:
if arg == "-f":
file_name = val
+ elif arg == "-c":
+ es = True
api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
- printer = PrintGlOffsets()
+ printer = PrintGlOffsets(es)
printer.Print(api)