diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-01-31 05:36:33 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-01-31 05:36:33 +0000 |
commit | bee9964b29b2428ee75e2d1efc0e1d2c2518a417 (patch) | |
tree | fd733f886743b31f2ac2727e57f05d1a0918a977 /src/mesa/glapi/gl_apitemp.py | |
parent | 36a0819ff4ede1af91dcf909106cf20659856384 (diff) | |
parent | 12eb32e34244db9923cacaaed9ba951b7ac274a4 (diff) |
Merge remote branch 'origin/master' into lp-binning
Conflicts:
Makefile
src/gallium/auxiliary/util/u_surface.c
src/gallium/drivers/llvmpipe/lp_flush.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_state_derived.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_tex_cache.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_tile_cache.c
src/mesa/state_tracker/st_cb_condrender.c
Diffstat (limited to 'src/mesa/glapi/gl_apitemp.py')
-rw-r--r-- | src/mesa/glapi/gl_apitemp.py | 125 |
1 files changed, 96 insertions, 29 deletions
diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py index a37c08d6ce..41a40fbeb6 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,10 +84,14 @@ class PrintGlOffsets(gl_XML.gl_print_base): else: dispatch = "DISPATCH" - if f.has_different_protocol(name): - print '#ifndef GLX_INDIRECT_RENDERING' - + 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 '' @@ -98,8 +104,6 @@ class PrintGlOffsets(gl_XML.gl_print_base): print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \ % (dispatch, f.name, p_string, name, t_string, o_string) print '}' - if f.has_different_protocol(name): - print '#endif /* GLX_INDIRECT_RENDERING */' print '' return @@ -172,7 +176,11 @@ class PrintGlOffsets(gl_XML.gl_print_base): #error TABLE_ENTRY must be defined #endif -static _glapi_proc DISPATCH_TABLE_NAME[] = {""" +#ifdef _GLAPI_SKIP_NORMAL_ENTRY_POINTS +#error _GLAPI_SKIP_NORMAL_ENTRY_POINTS must not be defined +#endif + +_glapi_proc DISPATCH_TABLE_NAME[] = {""" for f in api.functionIterateByOffset(): print ' TABLE_ENTRY(%s),' % (f.dispatch_name()) @@ -196,35 +204,90 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {""" * We list the functions which are not otherwise used. */ #ifdef UNUSED_TABLE_NAME -static _glapi_proc UNUSED_TABLE_NAME[] = {""" +_glapi_proc UNUSED_TABLE_NAME[] = {""" + normal_entries = [] + proto_entries = [] for f in api.functionIterateByOffset(): - for n in f.entry_points: - if n != f.name: - if f.is_static_entry_point(n): - text = ' TABLE_ENTRY(%s),' % (n) - - if f.has_different_protocol(n): - print '#ifndef GLX_INDIRECT_RENDERING' - print text - print '#endif' - else: - print text + normal_ents, proto_ents = self.classifyEntryPoints(f) + + # exclude f.name + if f.name in normal_ents: + normal_ents.remove(f.name) + elif f.name in proto_ents: + proto_ents.remove(f.name) + + normal_ents = [f.static_name(ent) for ent in normal_ents] + proto_ents = [f.static_name(ent) for ent in proto_ents] + + normal_entries.extend(normal_ents) + proto_entries.extend(proto_ents) + + print '#ifndef _GLAPI_SKIP_NORMAL_ENTRY_POINTS' + for ent in normal_entries: + print ' TABLE_ENTRY(%s),' % (ent) + print '#endif /* _GLAPI_SKIP_NORMAL_ENTRY_POINTS */' + print '#ifndef _GLAPI_SKIP_PROTO_ENTRY_POINTS' + for ent in proto_entries: + print ' TABLE_ENTRY(%s),' % (ent) + print '#endif /* _GLAPI_SKIP_PROTO_ENTRY_POINTS */' + print '};' print '#endif /*UNUSED_TABLE_NAME*/' print '' return + def classifyEntryPoints(self, func): + normal_names = [] + normal_stubs = [] + proto_names = [] + proto_stubs = [] + # classify the entry points + for name in func.entry_points: + if func.has_different_protocol(name): + if func.is_static_entry_point(name): + proto_names.append(name) + else: + proto_stubs.append(name) + else: + if func.is_static_entry_point(name): + normal_names.append(name) + else: + normal_stubs.append(name) + # there can be at most one stub for a function + if normal_stubs: + normal_names.append(normal_stubs[0]) + elif proto_stubs: + proto_names.append(proto_stubs[0]) + + return (normal_names, proto_names) + def printBody(self, api): + normal_entry_points = [] + proto_entry_points = [] for func in api.functionIterateByOffset(): - got_stub = 0 - for n in func.entry_points: - if func.is_static_entry_point(n): - self.printFunction(func, n) - elif not got_stub: - self.printFunction(func, n) - got_stub = 1 + normal_ents, proto_ents = self.classifyEntryPoints(func) + normal_entry_points.append((func, normal_ents)) + proto_entry_points.append((func, proto_ents)) + + print '#ifndef _GLAPI_SKIP_NORMAL_ENTRY_POINTS' + print '' + for func, ents in normal_entry_points: + for ent in ents: + self.printFunction(func, ent) + print '' + print '#endif /* _GLAPI_SKIP_NORMAL_ENTRY_POINTS */' + print '' + print '/* these entry points might require different protocols */' + print '#ifndef _GLAPI_SKIP_PROTO_ENTRY_POINTS' + print '' + for func, ents in proto_entry_points: + for ent in ents: + self.printFunction(func, ent) + print '' + print '#endif /* _GLAPI_SKIP_PROTO_ENTRY_POINTS */' + print '' self.printInitDispatch(api) self.printAliasedTable(api) @@ -232,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) |